




Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!





Problem 3. a. See SAS code
b.
Parameter Estimates
Variable DF
Parameter Estimate
Standard Error t Value Pr > |t|
95% Confidence Limits Intercept 1 33.14474 10.78486 3.07 0.0544 -1.17750 67. age (^) 1 3.35526 1.22905 2.73 0.0719 -0.55612 7.
are (-0.55612, 7.2664). There is no evidence that the slope is significantly greater than zero.
c. and d.
Output Statistics
Obs
Dependent Variable
Predicted Value
Std Error Mean Predict 95% CL Mean 95% CL Predict Residual (^2) 71.0000 66.6974 2.7482 57.9513 75.4435 49.1179 84.2768 4.
CL Mean is the confidence interval for the expected weight of 10 year old children CL Predict is the prediction interval for the newly selected 10 year old child. The predicted weight for a 10 yr old child is 66.6974 lbs.
e. See SAS code
weight = 33.145 +3.3553 age N 5 Rsq
AdjRsq
RMSE
w e i g h t
40
45
50
55
60
65
70
75
80
85
age
6.0 6.5 7.0 7.5 8.0 8.5 9.0 9.5 10.0 10.5 11.
Plot weightage PREDage L95Mage U95Mage
Problem 3.
a. See SAS IML code:
Parameter Estimates and Their Covariance Matrix B COVB 33.144737 116.31319 -12.
Confidence Interval for the Slope B1 LOWB1 UPB 3.3552632 -0.556119 7.
;
proc reg data=a; model weight = age / CLB CLM CLI P; plot (weight pred.)*age / conf OVERLAY; Title 'Regression of Weight on Age'; run ; quit ;
proc iml ; use a; read all var {weight} into yvec; /* reads variables from data set "a" into iml variables/ read all var {age} into xvec; close a; col1 = J( 5 , 1 , 1 ); / Creates a 5 by 1 vector or ones / xmat = col1||xvec; / Concatenates two vectors by columns to create the X matrix/ print col1 xvec xmat; n=nrow(xmat); /LEAST SQUARES AND COVARIANCE/ xpxinv=inv(t(xmat)xmat); b=xpxinv(t(xmat)yvec); yhat=xmatb; p=ncol(xmat); r=yvec-yhat; / computes residuals / sse=ssq(r); /computes residual sum of squares/ df=nrow(xmat)-ncol(xmat); mse=sse/df; covb=msexpxinv; /* USUAL ESTIMATE OF COVARIANCE / print 'Parameter Estimates and Their Covariance Matrix'; print b ' ' covb; b1=b[ 2 ]; varb1 = covb[ 2 , 2 ]; tval = tinv( 0.975 , df); lowb1 = b1 - tvalsqrt(varb1); upb1 = b1 + tvalsqrt(varb1); print 'Confidence Interval for the Slope'; print b1 ' ' lowb1 upb1; x0={ 1 , 10 }; muhat10 = t(x0)b; vmuhat10 = t(x0)covbx0; print 'Expected Weight at Age=10 and its Variance'; print x0 muhat10 vmuhat10; vpred10 = mse + vmuhat10; print 'predictor and the variance of the predictor of the weight of a future 10 year old child'; print x0 muhat10 vpred10; quit ;
ODS RTF Close;
Problem 3.
We start by looking at the descriptive statistics for the variables of interest – ENERGY and KCAL.
The following table was obtained in SAS (see SAS code) and contains the basic statistics for the variable ENERGY
Basic Statistical Measures (ENERGY) Location Variability Mean (^) 1933.165 Std Deviation (^) 587.
Median (^) 1849.645 Variance (^) 344927
Mode (^). Range (^) 3608 Interquartile Range (^) 788.
To closely examine the distribution of this variable a histogram was plotted.
600 1000 1400 1800 2200 2600 3000 3400 3800 4200
0
5
10
15
20
25
30
P e r c e n t
Energy (kcal) from 24 Hr recalls
In addition, several test for normality of the ENERGY variable were carried out using the UNIVARIATE procedure.
300 900 1500 2100 2700 3300 3900 4500 5100 5700 6300
0
5
10
15
20
25
30
35
40
P e r c e n t
Kcal Intake (formerly avener)
As seen in the histogram above, variable KCAL is also right skewed and the test for normality reveals significant deviation from normality.
Next, a regression model was fitted using the model below:
Output from the REG procedure (see SAS code) is shown below.
Parameter Estimates
Variable Label DF
Parameter Estimate
Standard Error t Value Pr > |t| Intercept (^) Intercept 1 1304.13276 72.66195 17.95 <.
kcal (^) Kcal Intake (formerly avener)
A plot with 95% confidence bands of the predicted kcal intake for a person in the study based on a 7-day dietary record is shown below:
energy = 1304.1 +0.3077 kcal N 272 Rsq
AdjRsq
RMSE
E n e r g y
( k c a l )
f r o m
2 4
H r
r e c a l l s
0
500
1000
1500
2000
2500
3000
3500
4000
4500
Kcal Intake (formerly avener)
0 1000 2000 3000 4000 5000 6000 7000
Plot energykcal PREDkcal L95kcal U95kcal
The prediction bands shown in the figure above estimate the bounds for the predicted ENERGY over the entire range of KCAL. Approximately 95% of the future ENERGY values over the range of KCAL would fall between the prediction bands.