#Exercise 6:  simple linear regression

 

# In this exercise we will use data from the Heart and Estrogen/Progestin Study (HERS), a clinical trial of hormone therapy for prevention of recurrent heart attacks and death among post-menopausal women with existing coronary heart disease. These data are used in many of the examples in Chapters 3 and 4 of the course text book byVittinghoff et al.

 

# In this exercise we will study the relation between the ages of the women and their systolic blood pressure (sbp). The cohort consists of 2763 women, but in this exercise we will (as in section 3.3 of byVittinghoff et al.) only use a 10% sample from the full cohort. You may read the data into R by the command:

hers.sample=read.table("http://www.uio.no/studier/emner/matnat/math/STK4900/v17/hers.sample.txt",header=T)

 

# a)

# Read the data into R (cf. above) and inspect the data. Make a plot of the systolic blood pressure versus age:

plot(hers.sample$age,hers.sample$sbp)

# Discuss what the plot tells you.

 

# b)

# Fit a linear regression model to the data, using systolic blood pressure as the outcome and age as the predictor:

hers.fit.b=lm(sbp~age,data=hers.sample)

summary(hers.fit.b)

# You may add the regression line to the plot from question a by the command: