Download data file: https://drive.google.com/open?id=0B6i_JzkQ2f6IYWxZSTdyRjRLWE
ID: 3269949 • Letter: D
Question
Download data file:
https://drive.google.com/open?id=0B6i_JzkQ2f6IYWxZSTdyRjRLWE0
The systolic and diastolic blood pressure (mm Hg) was recorded for 30 patients with moderate essential hypertension (Table below) [1]. Half of the group was measured immediately after taking the drug captopril (Drug=2) while the other half received a placebo (Drugs=1). The dataset bld.dat is (a) Fit a single regression model to predict Diastolic from Systolic BP. with separate slopes and intercepts for each Drug. (b) Determine if the slopes are different for each Drug. (c) Determine if the intercepts are different for each Drug.Explanation / Answer
All R codes is shown in bold and the output of the R code is shown in italics.
(a)
Read the data file in "bld" dataframe.
bld = read.table("bld.dat",header = TRUE)
Make the Drug variable as a categorical variable with levels 1, 2.
bld$Drug = as.factor(bld$Drug)
Run the linear regression to predict Diastolic from Systolic BP and Drug.
model = lm(Diastolic~Systolic+Drug,data = bld)
model
Call:
lm(formula = Diastolic ~ Systolic + Drug, data = bld)
Coefficients:
(Intercept) Systolic Drug2
52.4354 0.3769 -6.7808
The regression equation is
Diastolic = 52.4354 + 0.3769 * Systolic - 6.7808 Drug2
and Drug2 = 0 when Drug = 1 ; Drug2 = 1 when Drug = 2
So, the regression equation for Drug 1 is
Diastolic = 52.4354 + 0.3769 * Systolic
The regression equation for Drug 2 is
Diastolic = 52.4354 + 0.3769 * Systolic - 6.7808*1
Diastolic = 45.6546 + 0.3769 * Systolic
(b)
The slopes for each drug is 0.3769. So the slopes are same for each drug.
(c)
The intercept for drug 1 is 52.4354 and intercept for drug 2 is 45.6546. So the intercepts for each drug are different.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.