Data 1

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Question

1.

In the juul data set, fit a linear regression model for the square root of the IGF-I
concentration versus age to the group of subjects over 25 years old.

2.

In the malaria data set, analyze the log-transformed antibody level versus age. Make a plot
of the relation. Do you notice anything peculiar?

Answer is

library(ISwR)

attach(juul)

Summary(juul)

## age menarche sex igf1 tanner

## Min. : 0.17 Min. :1.0 Min. :1.00 Min. : 25 Min. :1.00


## 1st Qu.: 9.05 1st Qu.:1.0 1st Qu.:1.00 1st Qu.:202 1st Qu.:1.00

## Median :12.56 Median :1.0 Median :2.00 Median :314 Median :2.00

## imply :15.10 suggest :1.5 suggest :1.53 suggest :340 imply :2.64

## 3rd Qu.:16.86 3rd Qu.:2.0 3rd Qu.:2.00 3rd Qu.:463 3rd Qu.:5.00

## Max. :83.00 Max. :2.0 Max. :2.00 Max. :915 Max. :5.00

## NA's :5 NA's :635 NA's :5 NA's :321 NA's :240

## testvol

## Min. : 1.0

## 1st Qu.: 1.0

## Median : 3.0

## mean : 7.9

## third Qu.:15.0

## Max. :30.0

## NA's :859

Summary lm(sqrt(igf1) ~ age, data = juul, (subset = age > 25))

##

## Residuals :

## Min 1Q Median 3Q Max

## -4.864 -1.166 0.102 0.945 4.114


##

## Coefficients:

## Estimate Std. Error t value Pr(>|t|)

## (Intercept) 18.7103 0.4946 37.83 <2e-16 ***

## age -0.1053 0.0107 -9.83 <2e-16 ***

## ---

## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

##

## Residual standard error: 1.74 on 120 degrees of freedom

## (9 observations deleted due to missingness)

## Multiple R-squared: 0.446, Adjusted R-squared: 0.441

## F-statistic: 96.6 on 1 and 120 DF, p-value: <2e-16

library(ISwR)

attach(malaria)

## the following item is masked from juul:

##

## age
summary(malaria)

## subject age ab mal

## Min. : 1.0 Min. : 3.00 Min. : 2 Min. :0.00

## 1st Qu.: 25.8 1st Qu.: 5.75 1st Qu.: 29 1st Qu.:0.00

## Median : 50.5 Median : 9.00 Median : 111 Median :0.00

## suggest : 50.5 imply : 8.86 mean : 312 imply :0.27

## third Qu.: 75.2 3rd Qu.:12.00 3rd Qu.: 374 3rd Qu.:1.00

## Max. :100.0 Max. :15.00 Max. :2066 Max. :1.00

summary(lm(log(ab) ~ age, statistics = malaria))

##

## call:

## lm(components = log(ab) ~ age, statistics = malaria)

##

## Residuals:

## Min 1Q Median 3Q Max

## -4.075 -1.062 0.118 1.101 2.733

##

## Coefficients:

## Estimate Std. blunders t value Pr(>|t|)


## (Intercept) 3.8370 0.3802 10.09 <2e-16 ***

## age 0.1035 0.0395 2.62 0.01 *

## ---

## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

##

## Residual standard mistakes: 1.48 on 98degrees of freedom

## a couple of R-squared: 0.0654, Adjusted R-squared: 0.0558

## F-statistic: 6.85 on 1 and 98DF, p-value : 0.0103

plot(log(ab) ~ age, records = malaria), main=”Log (Antibody Level ) vs Age – Malaria “,

ylab= “Log(Antibody Level )” ,xlab= “Age”

Log(Antibody Level) vs Age -Malaria

Below
#The graph of log(Antibody level) vs Age appears to show a cyclic relationship between the two

variables in the Malaria dataset. There seem to spike approximately around ages 4, 6, and 11.

This could be due to the inherent nature of the disease.

You might also like