- Details
- Parent Category: Programming Assignments' Solutions

# We Helped With This Statistics with R Programming Homework: Have A Similar One?

Category | Programming |
---|---|

Subject | R | R Studio |

Difficulty | Graduate |

Status | Solved |

More Info | Assignment Statistics |

## Assignment Description

1. This problem is a follow up on problem 1 of assignment 5 about the regression through the origin model of the form

Y =β_{1}x+ε, where ε is the standard normal
distribution.

. (a) First, generate a predictor x as a random vector of length n = 100 from the standard normal and a response y as follows. y = 2x + ε

where ε is also a random vector of length n = 100 from the standard normal

that takes exactly the same values as x.

. (b) Perform a simple linear regression of y onto x, without an intercept.

Report the coefficient estimate βˆ_{1}, the
standard error of this coefficient estimate, and the t-statistic and p-value
associated with the null hypothesis H_{0 }: β_{1 }= 0. Comment
on these results. (You can perform regression without an intercept using the
command lm(y∼ x +
0).)

. (c) Now perform a simple linear regression of x onto y without an
intercept. Report the coefficient estimate βˆ_{1}, the standard error
of this coefficient estimate, and the t-statistic and p-value associated with
the null hypothesis H_{0 }: β_{1 }= 0. Comment on these
results.

. (d) What are the relationships between (a), the results obtained in (b) and the ones in (c)?

. (e) For the regression of Y onto X without an intercept, the t-statistic for

H_{0 }:

β_{1 }= 0 takes the form

T= B_{1 }− β_{1 }**/ **S/
√ S_{xx},

where

S^{2}= S S E / n-1 and

Note that these formulas are slightly different from those given in (slide 29, LinearRegression-1), since here we are performing regression without an in- tercept.

(f) Show algebraically (to receive bonus points), and confirm numerically in R, that the t-statistic above can be written as (values)

. (g) Using the results from (d), argue that the t-statistic for the regression of y onto

x is the same as the t-statistic for the regression of x onto y.

. (h) In
R, show that when regression is performed with an intercept, the tstatistic
forH_{0 }:β_{1 }=0 is the same for the regression of y onto x
as it is for the regression of x onto y.

4. The data set low bwt.txt contains information for a sample of 100 low birth weight infants. The variables are

sbp : maternal systolic blood pressure sex : gender of the baby

toxemia : toxemia during pregnancy (yes or no) germ.hem : germinal matrix hemorrhage (yes or no) gest.age : gestational age in weeks apgar5 : five-minute APGAR score

. (a) Using
germinal matrix hemorrhage as the response, fit a logistic regression model
where the predictor variable x_{1 }is the 5-minute APGAR score. Write
the equation and interpret β_{1}, the estimated coefficient of

Apgar score.

. (b) What is the estimate and 95% confidence interval for the slope

(coefficient for apgar5) in the odds ratio scale? Interpret the estimate

(what does the odds ratio mean?).

. (c) At the 0.05
level of significance, test the null hypothesis: H_{0 }: β_{1 }=
0 where β_{1 }is the coefficient for apgar5.

. (d) If a new infant from the population has an APGAR score of 3 what is the predicted probability that this child will experience a brain hemorrhage? What is the probability if the child’s score is 7?