Docsity

Multiple Linear Regression - Practice Problems with Solutions | PUBHLTH 640, Exams of Community Health

Toggle sidebar
bg1
PubHlth 640 2009 Stata 10 Illustration: Week 3 Solutions Multiple Linear Regression
Questions #2 and #3 of Week 3 Practice Problems
#2. In an experiment to describe the toxic action of a certain chemical on silkworm larvae, the relationship of
log10(dose) and log10(larva weight) to log10(survival) was sought. The data, obtained by feeding each larva a
precisely measured dose of the chemical in an aqueous solution and then recording the survival time (ie time until
death) are given in the table. Also given are relevant computer results and the analysis of variance table.
Larva 1 2 3 4 5 6 7 8
Y = log10(survival time) 2.836 2.966 2.687 2.679 2.827 2.442 2.421 2.602
X1=log10(dose) 0.150 0.214 0.487 0.509 0.570 0.593 0.640 0.781
X2=log10(weight) 0.425 0.439 0.301 0.325 0.371 0.093 0.140 0.406
Larva 9 10 11 12 13 14 15
Y = log10(survival time) 2.556 2.441 2.420 2.439 2.385 2.452 2.351
X1=log10(dose) 0.739 0.832 0.865 0.904 0.942 1.090 1.194
X2=log10(weight) 0.364 0.156 0.247 0.278 0.141 0.289 0.193
Y = 2.952 – 0.550 (X1)
Y = 2.187 + 1.370 (X2)
Y = 2.593 – 0.381 (X1) + ).871 (X2)
Source DF SSQ
Regression on X1 1 0.3633
Residual 13 0.1480
Source DF SSQ
Regression on X2 1 0.3332
Residual 13 0.1780
Source DF SSQ
Regression on X1 , X2 2 0.4637
Residual 12 0.04706
Z:\bigelow\....\web640\stata\week3_stata_2009.doc Page 1 of 9
pf3
pf4
pf5
pf8
pf9

Partial preview of the text

Download Multiple Linear Regression - Practice Problems with Solutions | PUBHLTH 640 and more Exams Community Health in PDF only on Docsity!

Questions #2 and #3 of Week 3 Practice Problems

#2. In an experiment to describe the toxic action of a certain chemical on silkworm larvae, the relationship of

log 10 (dose) and log 10 (larva weight) to log 10 (survival) was sought. The data, obtained by feeding each larva a

precisely measured dose of the chemical in an aqueous solution and then recording the survival time (ie time until

death) are given in the table. Also given are relevant computer results and the analysis of variance table.

Larva 1 2 3 4 5 6 7 8

Y = log 10 (survival time) 2.836 2.966 2.687 2.679 2.827 2.442 2.421 2.

X 1 =log 10 (dose) 0.150 0.214 0.487 0.509 0.570 0.593 0.640 0.

X 2 =log 10 (weight) 0.425 0.439 0.301 0.325 0.371 0.093 0.140 0.

Larva 9 10 11 12 13 14 15

Y = log 10 (survival time) 2.556 2.441 2.420 2.439 2.385 2.452 2.

X 1 =log 10 (dose) 0.739 0.832 0.865 0.904 0.942 1.090 1.

X 2 =log 10 (weight) 0.364 0.156 0.247 0.278 0.141 0.289 0.

Y = 2.952 – 0.550 (X 1 )

Y = 2.187 + 1.370 (X 2 )

Y = 2.593 – 0.381 (X 1 ) + ).871 (X 2 )

Source DF SSQ

Regression on X 1 1 0.

Residual 13 0.

Source DF SSQ

Regression on X 2 1 0.

Residual 13 0.

Source DF SSQ

Regression on X 1 , X 2 2 0.

Residual 12 0.

(a) Test for the significance of the overall regression involving both independent variables X 1 and X 2.

(b) Test to see whether using X 1 alone significantly helps in predicting survival time.

(c) Test to see whether using X 2 alone significantly helps in predicting survival time.

(d) Compute R

for each of the three models.

(e) Which independent predictor do you consider to be the best single predictor of survival time?

(f) Which model involving one or both of the independent predictors do you prefer and why?

#3. Using whatever software package you like (SAS, SPSS, Stata, Minitab), try your hand at reproducing the

analysis of variance tables you worked with in problem #2.

log: /Users/carolbigelow/Desktop/week3.log log type: text opened on: 17 Feb 2009, 11:07:

. * The command SET MORE OFF prevents screen by screen pauses in display of results . set more off . * From the FILE drop down menu, the command OPEN will import the data The following will then appear on your results window for you; I did not actually type it. . use "/Users/carolbigelow/Desktop/1. Teaching/web640/data sets/week03.dta" . * The command DESCRIBE provides a description of the data set structure . describe

Contains data from /Users/carolbigelow/Desktop/1. Teaching/web640/data sets/week03.dta obs: 15 vars: 3 size: 240 (99.9% of memory free)


storage display value variable name type format label variable label


y float %9.0g x1 float %9.0g x2 float %9.0g


Sorted by:

. * The command LABEL VARIABLE allows you to give names to the variables . * Note: Stata requires that you use the command LABEL VARIABLE for each variable. You cannot label multiple * variables with one command. . label variable y "Y: log10(survival)" . label variable x1 "X1: log10(dose)" . label variable x2 "X2: log10(weight)"

These variable labels will appear on your output when you ask for summary statistics. They do Not appear in the output for regression requests. As a matter of good programming, I suggest that you get in the habit of naming your variables using the LABEL VARIABLE command.

#3. Using whatever software package you like (SAS, SPSS, Stata, Minitab), try your hand at reproducing

the analysis of variance tables you worked with in problem #2.

. * ------ Analysis of Variance Table for One Predictor Model: x1 ---* . * The command REGRESS fits the model and produces the anova table . regress y x

Source | SS df MS Number of obs = 15 -------------+------------------------------ F( 1, 13) = 31. Model | .363274049 1 .363274049 Prob > F = 0. Residual | .147992891 13 .011384069 R-squared = 0. -------------+------------------------------ Adj R-squared = 0. Total | .51126694 14 .036519067 Root MSE =.

y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- x1 | -.5498559 .0973376 -5.65 0.000 -.7601409 -. _cons | 2.952199 .073555 40.14 0.000 2.793293 3.


. * ------ Analysis of Variance Table for One Predictor Model: x2 ---* . regress y x

Source | SS df MS Number of obs = 15 -------------+------------------------------ F( 1, 13) = 25. Model | .336674125 1 .336674125 Prob > F = 0. Residual | .174592816 13 .013430217 R-squared = 0. -------------+------------------------------ Adj R-squared = 0. Total | .51126694 14 .036519067 Root MSE =.


y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- x2 | 1.375579 .2747401 5.01 0.000 .7820388 1. _cons | 2.184706 .0819958 26.64 0.000 2.007565 2.


. * ------ Analysis of Variance Table for One Predictor Model: x1 and x2 ---* . regress y x1 x

Source | SS df MS Number of obs = 15 -------------+------------------------------ F( 2, 12) = 59. Model | .46420206 2 .23210103 Prob > F = 0. Residual | .04706488 12 .003922073 R-squared = 0. -------------+------------------------------ Adj R-squared = 0. Total | .51126694 14 .036519067 Root MSE =.

y | Coef. Std. Err. t P>|t| [95% Conf. Interval] -------------+---------------------------------------------------------------- x1 | -.3784805 .0663741 -5.70 0.000 -.5230972 -. x2 | .8749749 .1724835 5.07 0.000 .4991656 1. _cons | 2.588996 .0836079 30.97 0.000 2.40683 2.


(c)Test to see whether using X 2 alone significantly helps in predicting survival time.|

Solution uses output for fit of the X2 alone predictor model:

. regress y x

MS(model)

F=

MS(residual)

= 25.07 w df=1,

Source | SS df MS Number of obs = 15 -------------+------------------------------ F( 1, 13) = 25. Model | .336674125 1 .336674125 Prob > F = 0. Residual | .174592816 13 .013430217 R-squared = 0. -------------+------------------------------ Adj R-squared = 0. Total | .51126694 14 .036519067 Root MSE =. Reject Null (P = .0002).Conclude model explains a significant proportion of the total variability in y.

(d) Compute R for each of the three models.|

. regress y x1 x

Source | SS df MS Number of obs = 15 -------------+------------------------------ F( 2, 12) = 59. Model | .46420206 2 .23210103 Prob > F = 0. Residual | .04706488 12 .003922073 R-squared = 0. -------------+------------------------------ Adj R-squared = 0. Total | .51126694 14 .036519067 Root MSE =.

R =^2 SS(model)

SS(total)

regress y x

Source | SS df MS Number of obs = 15 -------------+------------------------------ F( 1, 13) = 31. Model | .363274049 1 .363274049 Prob > F = 0. Residual | .147992891 13 .011384069 R-squared = 0. -------------+------------------------------ Adj R-squared = 0. Total | .51126694 14 .036519067 Root MSE =.

R =^2 SS(model)

SS(total)

. regress y x

R =^2 SS(model)

SS(total)

Source | SS df MS Number of obs = 15 -------------+------------------------------ F( 1, 13) = 25. Model | .336674125 1 .336674125 Prob > F = 0. Residual | .174592816 13 .013430217 R-squared = 0. -------------+------------------------------ Adj R-squared = 0. Total | .51126694 14 .036519067 Root MSE =.

(e) Which independent predictor do you consider to be the best single predictor of survival time.|

Based on the overall F test and size of R 2 , the single predictor model utilizing X 1 is better.