You are on page 1of 12

Derek Rampal

HW4
Chapter 9: 9.5, 9.24

30
20

25

VO2_Max

35

40

9.5
c) (Intercept)
3.158795
Duration
0.05029231
d)

350

400

450

500
Duration

e)
9.58902
3.096614
f)
660

38.1

36.35172

1.748278

0.571421

628

38.4

34.74237

3.657632

1.195489

637

41.7

35.195

6.505002

2.126146

575

33.5

32.07688

1.423125

0.465145

550

600

650

g)

590

28.6

32.83126

-4.23126

-1.38298

600

23.9

33.33418

-9.43418

-3.08354

562

29.6

31.42307

-1.82307

-0.59587

495

27.3

28.05349

-0.75349

-0.24628

540

33.2

30.31664

2.883356

0.942419

470

26.6

26.79618

-0.19618

-0.06412

408

23.6

23.67806

-0.07806

-0.02551

387

23.1

22.62192

0.47808

0.156259

564

36.6

31.52366

5.07634

1.659191

603

35.8

33.48506

2.31494

0.756633

420

28

24.28157

3.718433

1.215362

573

33.8

31.97629

1.82371

0.596076

602

33.6

33.43477

0.165233

0.054006

430

21

24.78449

-3.78449

-1.23695

508

31.2

28.70729

2.49271

0.814737

565

31.2

31.57395

-0.37395

-0.12223

464

23.7

26.49443

-2.79443

-0.91335

495

24.5

28.05349

-3.55349

-1.16145

461

30.5

26.34355

4.156449

1.358526

540

25.9

30.31664

-4.41664

-1.44357

588

32.7

32.73068

-0.03068

-0.01003

498

26.9

28.20437

-1.30437

-0.42633

483

24.6

27.44998

-2.84998

-0.93151

554

28.8

31.02074

-2.22074

-0.72584

521

25.9

29.36109

-3.46109

-1.13125

436

24.4

25.08624

-0.68624

-0.2243

398

26.3

23.17514

3.124864

1.021355

366

23.2

21.56578

1.634218

0.534141

439

24.6

25.23712

-0.63712

-0.20824

549

28.8

30.76927

-1.96927

-0.64365

360

19.6

21.26403

-1.66403

-0.54388

566

31.4

31.62424

-0.22424

-0.07329

407

26.6

23.62777

2.972233

0.971468

602

30.6

33.43477

-2.83477

-0.92654

488

27.5

27.70144

-0.20144

-0.06584

526

30.9

29.61255

1.287448

0.4208

524

33.9

29.51197

4.388033

1.434219

562

32.3

31.42307

0.876925

0.286621

496

26.9

28.10378

-1.20378

-0.39345

5
0
-10

-5

model.1$residuals

25

30

35

model.1$fitted.values
h)
Though there is a change in the variance as a function of the fitted values and hence a transformation may help to
stabilize the variance, this plot seems to arguably satisfy the uniform variance assumption.
But, it seems an outlier could be drastically affecting the regressions results.
i)

0
-1
-3

-2

Sample Quantiles

Normal Q-Q Plot

-2

-1

Theoretical Quantiles
j)
There is one obvious outlier. The regression seems to be significantly affected by it. There will be leverage points
after removal. There are a few points in the center which seemingly show a slight violation.
The normality plot seems otherwise satisfied.
kiv)
Call:
lm(formula = VO2_Max ~ Duration)
Residuals:
Min 1Q Median 3Q Max
-9.4342 -1.8962 -0.1962 2.0693 6.5050
Coefficients:
Estimate Std. Error t value Pr(>|t|)

(Intercept) 3.158795 3.215648 0.982 0.332


Duration 0.050292 0.006178 8.141 4.25e-10 ***
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
Residual standard error: 3.097 on 41 degrees of freedom
Multiple R-squared: 0.6178, Adjusted R-squared: 0.6085
F-statistic: 66.28 on 1 and 41 DF, p-value: 4.248e-10
As shown in the preceding table, the t value is 8.141 and the respective p-value is 4.25e-10 ~ 0 (which is
approximately zero)
m)
Analysis of Variance Table
Response: VO2_Max
Df Sum Sq Mean Sq F value Pr(>F)
Duration 1 635.52 635.52 66.275 4.248e-10 ***
Residuals 41 393.15 9.59
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
p)
0.7860067
qii)
transformed back using (exp(2y)-1)/(exp(2y)+1)
(0.6357445, 0.878873)
9.24)
I will assume the question is asking, is there a linear association?
Perform correlation test again
Pearson's product-moment correlation
data: Pre and Post
t = 4.631, df = 17, p-value = 0.0002388
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.4429204 0.8968417
sample estimates:
cor
0.7468746
Significant, can not accept null hypothesis that rho = 0. The correlation coefficient is different from zero at the 95
percent level.
Call:
lm(formula = Post ~ Pre)
Residuals:
Min
1Q Median
3Q
Max
-0.193425 -0.057482 0.005125 0.090560 0.170198
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.04821 0.11426 0.422 0.678342
Pre
0.92753 0.20029 4.631 0.000239 ***

--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1


Residual standard error: 0.1102 on 17 degrees of freedom
Multiple R-squared: 0.5578, Adjusted R-squared: 0.5318
F-statistic: 21.45 on 1 and 17 DF, p-value: 0.0002388
(c)
0.04821 0.92753
(k-iii)
0.3470434 1.5080166
(l-iii)
-0.2829418 0.3793618
(p)
0.7468746
Chapter 13: 13.1, 13.2 (Table 13.1, not 13.7. Malnutrition was denoted by X2), 13.3 (again, table 13.1 in section
13.3.1), 13.5, 13.7 (use p-value to make decision), 13.14 (bonus).
13.1)
As shown in class, from ln(pi/1-pi)=alpha + beta *x
Pi/(1-pi) = exp(alpha)*exp(beta*x)
Evaluate with x1=1/x1=0 = ODDS(X1=1)/ODDS(X1=0)=exp(beta)
13.2)
Call:
glm(formula = Death ~ Malnutrion, family = "binomial")
Deviance Residuals:
Min
1Q Median
3Q Max
-0.9178 -0.5389 -0.5389 -0.5389 2.0007
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -1.8563 0.3400 -5.459 4.79e-08 ***
Malnutrion 1.2097 0.5041 2.399 0.0164 *
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 105.528 on 105 degrees of freedom
Residual deviance: 99.796 on 104 degrees of freedom
AIC: 103.8
Number of Fisher Scoring iterations: 4
a)
observed =1.209671 ~ 1.2097 (from R)
b)
0.3437561 as compared to actual 11/32 =.34375
c)
CI(95%) = (0.2216822, 2.197718)
Since this interval does not contain zero, this is significant at the 95 percent level.
d)
0.504136.same?
Not sure I did this correctly.

13.3)
why does the data jump from 217 to 301?
Call:
glm(formula = Y ~ X1 + X2 + X3 + X4 + X5, family = "binomial")
Deviance Residuals:
Min
1Q Median
3Q Max
-1.3277 -0.4204 -0.0781 -0.0274 3.2946
Coefficients:
Estimate Std. Error z value Pr(>|z|)
(Intercept) -9.75391 2.54170 -3.838 0.000124 ***
X1
3.67387 1.16481 3.154 0.001610 **
X2
1.21658 0.72822 1.671 0.094798 .
X3
3.35488 0.98210 3.416 0.000635 ***
X4
0.09215 0.03032 3.039 0.002374 **
X5
2.79759 1.16397 2.403 0.016240 *
--Signif. codes: 0 *** 0.001 ** 0.01 * 0.05 . 0.1 1
(Dispersion parameter for binomial family taken to be 1)
Null deviance: 105.528 on 105 degrees of freedom
Residual deviance: 53.122 on 100 degrees of freedom
AIC: 65.122
Number of Fisher Scoring iterations: 7
a)
included X1 in model as question stated Full model, but did not specify X1s value, so I reported both functions.
if X1 = 0; function is y = -3.60144+ 0.09215 X4

5
4
3
2
1
-2

-1

-3.60144 + 0.09215 * X4

20

40

60
X4

if X1 = 1 function is y = 0.07243 + 0.09215 X4

80

20

b)

40
60

X4
80

0.07243 + 0.09215 * X4
7

20
40
60

X4
80

0.2

0.4

0.6

0.8

1/(1 + exp(-(-3.60144 + 0.09215 * X4)))


1.0

1.00
0.95
0.90
0.85

1/(1 + exp(-(0.07243 + 0.09215 * X4)))

20

40

60

80

X4
c)
0.8729791
13.7)
a)
0.05190695
0.02321297
b)
exp(alpha) = odds ratio associated with chol=0, systolic=0.cig=0
exp(B1) = multiplicative change in odds ratio with a one unit change in cholesterol
exp(B2) = multiplicative change in odds ratio with a one unit change in Systolic Blood Pressure
exp(B3) = multiplicative change in odds ratio with a one unit change in Cigarettes
c)
Table of Bij/se(Bij)

Where i goes from one to three representing the respective coefficients and j =1 is the logistic model and j=2 is the
discriminant model..
4.972222222
3.258823529
2.781590763
6.051282051
3.02
3.153282615
All terms seem to be significant.
13.14)
See attached

You might also like