Homework2Key

docx

School

University of Michigan *

*We aren’t endorsed by this school

Course

522

Subject

Statistics

Date

Feb 20, 2024

Type

docx

Pages

5

Uploaded by AdmiralGoatPerson1056

Report
Homework 2 Key BIOSTAT 522 1) For the regression model to assess if anxiety is predictive of pain, the errors, e i , are assumed to follow a Normal distribution with mean 0 and standard deviation, . First σ find the estimate of for the model σ , then find the sample standard deviation of pain. Compare the estimates of σ from the regression model with the sample standard deviation of pain and describe in one or two sentences why and how they are different. The sample standard deviation for pain is 2.52 ^ σ = Root MSE = 2.173 (Residual standard error in R) 𝜎̂ measures the variation between pain and its estimated values. Sample standard deviation measures the variation between pain and its overall mean. The estimate for 𝜎 is smaller than the sample standard deviation since part of the variation is explained by the covariate anxiety. 1
Whenever asked to do a test, state H 0 and H 1 , write the test statistic (formula), state the test statistic’s reference distribution, compute the test statistic and p-value, and draw a conclusion. 2) Test to assess if pain is associated with anxiety . 𝐻 0 : 𝛽 1 = 0 𝐻 1 : 𝛽 1 ≠ 0 𝑡 = ^ β 1 s.e . ( ^ β 1 ) = 0.485 0.058 = 8.33 ~ 𝑡 197 (T distribution, 197 degrees of freedom) p-value < 0.0001 Conclusion: Reject H 0 ! There is strong evidence that pain is associated with anxiety. 3) What are the predicted pain and residual of a patient who had anxiety score of 4 and pain score of 8 based on the fitted model? Model: 𝑃𝑎𝑖𝑛 𝑖 = 2.696 + 0.485 ∗ 𝐴𝑛𝑥𝑖𝑒𝑡𝑦 𝑖 + 𝜀 𝑖 Predicted Pain: 𝑦̂ 𝑖 = 2.696 + 0.485 ∗ (4) = 4.636 Residual: (𝑦 𝑖 −𝑦̂ 𝑖 )=8−4.636=3.364 4) Compute a 95% confidence interval for the mean change in pain score per two unit increase in anxiety based on the model. 95% Confidence Interval: = 2𝛽 1 ± 1.972 Var ( 2 β 1 ) =2𝛽 1 ±1.972 2 2 Var ( β 1 ) = 2𝛽 1 ±1.972∗2∗𝑆𝐷(𝛽 1 ) = 2∗0.485±1.972∗2∗0.058 = 0.97 ± 0.229 = (0.741, 1.199) 2
5) Compute by hand a 95% confidence interval for mean pain when anxiety = 4 and a 95% prediction interval (PI) for pain when anxiety = 4. Briefly contrast the CI vs. PI. 95% Confidence Interval (you might get slightly different answer depending on what value you use for the t statistic) ¿ ^ μ ( x 0 ) ±t n 2,0.975 ^ σ 1 n + ( x 0 x ) 2 SSX ¿ ( 2.696 + 0.485 4 ) ± 1.972 2.173 1 199 + ( 4 2.111 ) 2 1390 ¿ ( 4.26 , 5.01 ) 95% Prediction Interval (you might get slightly different answer depending on what value you use for the t statistic) ¿ ^ μ ( x 0 ) ±t n 2,0.975 ^ σ 1 + 1 n + ( x 0 x ) 2 SSX ¿ ( 2.696 + 0.485 4 ) ± 1.972 2.173 1 + 1 199 + ( 4 2.111 ) 2 1390 ¿ ( 0.33,8.94 ) Prediction intervals must account for both the uncertainty in knowing the value of the population mean as well as the scatter of the data (the additional ‘1’ under the radical). That’s why the prediction interval is wider than the confidence interval. 6) What fraction of the variation in pain is explained by anxiety ? 𝑅 2 = 0.2604 26.04% of the variation in pain is explained by anxiety. 7) What fraction of the variation in anxiety is explained by the variation in pain ? Compare your answer to this problem with what you found in the problem above. 3
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
𝑅 2 = 0.2604 Similar to the above: 26.04% of the variation in anxiety is explained by pain. 8) [SLR3 note] Now you will hand calculate the intercept and slope estimates for the model where Y = pain and X = anxiety using only what you obtain from PROC MEANS and PROC CORR. Read below hints first to avoid making mistakes. Please paste the output and show your work for the hand calculations. ^ β 1 = SD ( Y ) SD ( X ) ×r = 2.52049 2.64979 × 0.51027 = 0.485 ^ β 0 = Y ^ β 1 X = 3.72060 0.485 × 2.11106 = 2.696 SAS CODE libname homework 'C:\Users\amwallpa\Downloads' ; 4
DATA tmp; set homework.surgery; RUN ; **5); PROC MEANS data = tmp css ; where pain NE . and anxiety NE . ; var pain anxiety; RUN ; **8); PROC CORR data = tmp; where pain NE . and anxiety NE . ; var pain anxiety; RUN ; R CODE # reading in the data surgery = read.csv(‘~/Downloads/surgery.txt", header=T) # Question 5 # SSX anxiety = surgery$anxiety[complete.cases(cbind(surgery$pain, surgery$anxiety))] sum((anxiety - mean(anxiety))^2) # Question 8 #Correlation pain = surgery$pain[complete.cases(cbind(surgery$pain, surgery$anxiety))] cor(cbind(pain,anxiety)) # Another way to find correlation cor(surgery$pain, surgery$anxiety, use=’complete.obs’) 5