In: Statistics and Probability
STAT | ||||||||||||
PatientID | Age | Sex | County | CardioRisk | Height | Weight | BloodGroup | Stroke | RegularEx | Group | Cholesterol1 | Cholesterol2 |
225 | 58 | Male | Offaly | Low | 179.2 | 103.5 | AB | N | N | Placebo | 6.1 | 4.6 |
226 | 61 | Male | Carlow | Medium | 174.9 | 63 | AB | Y | N | Control | 2.2 | 5.7 |
227 | 57 | Female | Donegal | Medium | 161.9 | 76.1 | B | N | Y | Control | 5.8 | 5 |
228 | 43 | Male | Offaly | High | 176 | 83.7 | AB | Y | N | Control | 3.6 | 2.4 |
229 | 37 | Female | Longford | Low | 157.8 | 68 | B | N | Y | Control | 4.9 | 6 |
230 | 29 | Male | Leitrim | Medium | 166.1 | 79.1 | A | Y | Y | Placebo | 3.5 | 5.3 |
231 | 52 | Male | Cavan | Low | 167.6 | 60.4 | A | Y | Y | Placebo | 2.9 | 4 |
232 | 47 | Female | Westmeath | Low | 167.8 | 63.6 | B | N | Y | Control | 4 | 3.2 |
233 | 28 | Male | Wicklow | Low | 170.5 | 67.2 | O | Y | N | Control | 4.2 | 4 |
The commands to these questions using rstudio
Q1
The researchers want to explore the relationship between Cholesterol level and BMI.
a. Using the cholesterol level before the study (Cholesterol1), compute the correlation coefficient between
BMI and cholesterol level.
b. Fit the regression line between BMI and cholesterol level, using cholesterol level as the response variable.
Write down the equation of the estimated regresison line and your specify your parameter values.
c. What is the value of the coefficient of determination?
d. Perform a model utility test. Write down the hypothesis your are testing, the value of the test statistic
and of the corresponding p-value. For a significance level of 0.05, what is the outcome of the test?
R-code:
data=read.table("clipboard",sep="\t",header=T)
BMI=data$Weight/((data$Height/100)^2) ## weight/(height in
m.)^2
BMI
Cholesterol1=data$Cholesterol1
cor(BMI,Cholesterol1)## correlation
model=lm(Cholesterol1~BMI)## model fitting
summary(model)
anova(model)