**Regression Models Quiz Answer. In this post you will get Quiz & Assignment Answer Of Regression Models**

## Regression Models Quiz

## Offered By ”Johns Hopkins University”

**Quiz 1**

1.

Question 1

Consider the data set given below

1 point

- 1.077
- 0.300
**0.1471**- 0.0025

2.

Question 2

Consider the following data set

12

x <- c(0.8, 0.47, 0.51, 0.73, 0.36, 0.58, 0.57, 0.85, 0.44, 0.42)

y <- c(1.39, 0.72, 1.55, 0.48, 1.19, -1.59, 1.23, -0.65, 1.49, 0.05)

Fit the regression through the origin and get the slope treating y

as the outcome and x as the regressor. (Hint, do not center the data since we want regression through the origin, not through the means of the data.)

1 point

- -1.713
**0.8263**- 0.59915
- -0.04462

3.

Question 3

Do \verb|data(mtcars)|data(mtcars) from the datasets package and fit the regression

model with mpg as the outcome and weight as the predictor. Give

the slope coefficient.

1 point

- 0.5591
- -9.559
**-5.344**- 30.2851

4.

Question 4

Consider data with an outcome (Y) and a predictor (X). The standard deviation of the predictor is one half that of the outcome. The correlation between the two variables is .5. What value would the slope coefficient for the regression model with YY as the outcome and XX as the predictor?

1 point

**1**- 3
- 4
- 0.25

5.

Question 5

Students were given two hard tests and scores were normalized to have empirical mean 0 and variance 1. The correlation between the scores on the two tests was 0.4. What would be the expected score on Quiz 2 for a student who had a normalized score of 1.5 on Quiz 1?

1 point

**0.6**- 0.16
- 0.4
- 1.0

6.

Question 6

Consider the data given by the following

1

x <- c(8.58, 10.46, 9.01, 9.64, 8.86)

What is the value of the first measurement if x were normalized (to have mean 0 and variance 1)?

1 point

- 8.86
- 9.31
- 8.58
**-0.9719**

7.

Question 7

Consider the following data set (used above as well). What is the intercept for fitting the model with x as the predictor and y as the outcome?

12

x <- c(0.8, 0.47, 0.51, 0.73, 0.36, 0.58, 0.57, 0.85, 0.44, 0.42)

y <- c(1.39, 0.72, 1.55, 0.48, 1.19, -1.59, 1.23, -0.65, 1.49, 0.05)

1 point

**1.567**- 1.252
- 2.105
- -1.713

8.

Question 8

You know that both the predictor and response have mean 0. What

can be said about the intercept when you fit a linear regression?

1 point

- It is undefined as you have to divide by zero.
- It must be exactly one.
- Nothing about the intercept can be said from the information given.
**It must be identically 0.**

9.

Question 9

Consider the data given by

1

x <- c(0.8, 0.47, 0.51, 0.73, 0.36, 0.58, 0.57, 0.85, 0.44, 0.42)

What value minimizes the sum of the squared distances between these points and itself?

1 point

- 0.44
- 0.36
**0.573**- 0.8

10.

Question 10

Let the slope having fit Y as the outcome and X as the predictor be denoted as \beta_1 β

. What is this ratio always equal to?

1 point

- 1
- 2SD(Y) / SD(X)2SD(Y)/SD(X)
- Cor(Y, X)Cor(Y,X)
**Var(Y) / Var(X)Var(Y)/Var(X)**

**Quiz 2**

1.

Question 1

Consider the following data with x as the predictor and y as as the outcome.

12

x <- c(0.61, 0.93, 0.83, 0.35, 0.54, 0.16, 0.91, 0.62, 0.62)

y <- c(0.67, 0.84, 0.6, 0.18, 0.85, 0.47, 1.1, 0.65, 0.36)

Give a P-value for the two sided hypothesis test of whether \beta_1 β

1

from a linear regression model is 0 or not.

1 point

**0.05296**

2.325

0.391

0.025

2.

Question 2

Consider the previous problem, give the estimate of the residual standard deviation.

1 point

0.3552

**0.223**

0.4358

0.05296

3.

Question 3

In the \verb|mtcars|mtcars data set, fit a linear regression model of weight (predictor) on mpg (outcome). Get a 95% confidence interval for the expected mpg at the average weight. What is the lower endpoint?

1 point

21.190

**18.991**

-4.00

-6.486

4.

Question 4

Refer to the previous question. Read the help file for \verb|mtcars|mtcars. What is the weight coefficient interpreted as?

1 point

**The estimated expected change in mpg per 1,000 lb increase in weight.**

The estimated expected change in mpg per 1 lb increase in weight.

It can’t be interpreted without further information

The estimated 1,000 lb change in weight per 1 mpg increase.

5.

Question 5

Consider again the \verb|mtcars|mtcars data set and a linear regression model with mpg as predicted by weight (1,000 lbs). A new car is coming weighing 3000 pounds. Construct a 95% prediction interval for its mpg. What is the upper endpoint?

1 point

-5.77

**27.57**

21.25

14.93

6.

Question 6

Consider again the \verb|mtcars|mtcars data set and a linear regression model with mpg as predicted by weight (in 1,000 lbs). A “short” ton is defined as 2,000 lbs. Construct a 95% confidence interval for the expected change in mpg per 1 short ton increase in weight. Give the lower endpoint.

1 point

-9.000

4.2026

**-12.973**

-6.486

7.

Question 7

If my X from a linear regression is measured in centimeters and I convert it to meters what would happen to the slope coefficient?

1 point

**It would get multiplied by 100.**

It would get divided by 10

It would get divided by 100

It would get multiplied by 10

8.

Question 8

. What would be the consequence to the subsequent slope and intercept if I were to refit the model with a new regressor, X + cX+c for some constant, cc?

1 point

The new slope would be \hat \beta_1 + c β^ 1+c

The new intercept would be \hat \beta_0 + c \hat \beta_1β^0+cβ^1

**The new intercept would be \hat \beta_0 – c \hat \beta_1β^0−cβ^1**

The new slope would be c \hat \beta_1cβ^1

9.

Question 9

Refer back to the mtcars data set with mpg as an outcome and weight (wt) as the predictor. About what is the ratio of the the sum of the squared errors, \sum_{i=1}^n (Y_i

when comparing a model with just an intercept (denominator) to the model with the intercept and slope (numerator)?

1 point

0.50

0.75

**0.25**

4.00

10.

Question 10

Do the residuals always have to sum to 0 in linear regression?

1 point

If an intercept is included, the residuals most likely won’t sum to zero.

The residuals never sum to zero.

The residuals must always sum to zero.

**If an intercept is included, then they will sum to 0.**

**Quiz 3**

1.

Question 1

Consider the \verb| mtcars| mtcars data set. Fit a model with mpg as the outcome that includes number of cylinders as a factor variable and weight as confounder. Give the adjusted estimate for the expected change in mpg comparing 8 cylinders to 4.

1 point

33.991

-3.206

**-6.071**

-4.256

2.

Question 2

Consider the \verb| mtcars| mtcars data set. Fit a model with mpg as the outcome that includes number of cylinders as a factor variable and weight as a possible confounding variable. Compare the effect of 8 versus 4 cylinders on mpg for the adjusted and unadjusted by weight models. Here, adjusted means including the weight variable as a term in the regression model and unadjusted means the model without weight included. What can be said about the effect comparing 8 and 4 cylinders after looking at models with and without weight included?.

1 point

Holding weight constant, cylinder appears to have more of an impact on mpg than if weight is disregarded.

Within a given weight, 8 cylinder vehicles have an expected 12 mpg drop in fuel efficiency.

**Holding weight constant, cylinder appears to have less of an impact on mpg than if weight is disregarded.**

Including or excluding weight does not appear to change anything regarding the estimated impact of number of cylinders on mpg.

3.

Question 3

Consider the \verb|mtcars|mtcars data set. Fit a model with mpg as the outcome that considers number of cylinders as a factor variable and weight as confounder. Now fit a second model with mpg as the outcome model that considers the interaction between number of cylinders (as a factor variable) and weight. Give the P-value for the likelihood ratio test comparing the two models and suggest a model using 0.05 as a type I error rate significance benchmark.

1 point

The P-value is larger than 0.05. So, according to our criterion, we would fail to reject, which suggests that the interaction terms is necessary.

The P-value is small (less than 0.05). So, according to our criterion, we reject, which suggests that the interaction term is not necessary.

The P-value is small (less than 0.05). So, according to our criterion, we reject, which suggests that the interaction term is necessary

The P-value is small (less than 0.05). Thus it is surely true that there is no interaction term in the true model.

The P-value is small (less than 0.05). Thus it is surely true that there is an interaction term in the true model.

**The P-value is larger than 0.05. So, according to our criterion, we would fail to reject, which suggests that the interaction terms may not be necessary.**

4.

Question 4

Consider the \verb|mtcars|mtcars data set. Fit a model with mpg as the outcome that includes number of cylinders as a factor variable and weight inlcuded in the model as

1

lm(mpg ~ I(wt * 0.5) + factor(cyl), data = mtcars)

How is the wt coefficient interpretted?

1 point

The estimated expected change in MPG per half ton increase in weight.

The estimated expected change in MPG per half ton increase in weight for for a specific number of cylinders (4, 6, 8).

The estimated expected change in MPG per half ton increase in weight for the average number of cylinders.

The estimated expected change in MPG per one ton increase in weight.

**The estimated expected change in MPG per one ton increase in weight for a specific number of cylinders (4, 6, 8).**

5.

Question 5

Consider the following data set

12

x <- c(0.586, 0.166, -0.042, -0.614, 11.72)

y <- c(0.549, -0.026, -0.127, -0.751, 1.344)

Give the hat diagonal for the most influential point

1 point

0.2804

**0.9946**

0.2025

0.2287

6.

Question 6

Consider the following data set

12

x <- c(0.586, 0.166, -0.042, -0.614, 11.72)

y <- c(0.549, -0.026, -0.127, -0.751, 1.344)

Give the slope dfbeta for the point with the highest hat value.

1 point

-0.378

-.00134

0.673

**-134**

7.

Question 7

Consider a regression relationship between Y and X with and without adjustment for a third variable Z. Which of the following is true about comparing the regression coefficient between Y and X with and without adjustment for Z.

1 point

The coefficient can’t change sign after adjustment, except for slight numerical pathological cases.

For the the coefficient to change sign, there must be a significant interaction term.

Adjusting for another variable can only attenuate the coefficient toward zero. It can’t materially change sign.

**It is possible for the coefficient to reverse sign after adjustment. For example, it can be strongly significant and positive before adjustment and strongly significant and negative after adjustment.**

**Quiz 4**

1.

Question 1

Consider the space shuttle data \verb|?shuttle|?shuttle in the \verb|MASS|MASS library. Consider modeling the use of the autolander as the outcome (variable name \verb|use|use). Fit a logistic regression model with autolander (variable auto) use (labeled as “auto” 1) versus not (0) as predicted by wind sign (variable wind). Give the estimated odds ratio for autolander use comparing head winds, labeled as “head” in the variable headwind (numerator) to tail winds (denominator).

1 point

**0.969**

1.327

-0.031

0.031

2.

Question 2

Consider the previous problem. Give the estimated odds ratio for autolander use comparing head winds (numerator) to tail winds (denominator) adjusting for wind strength from the variable magn.

1 point

**0.969**

1.00

1.485

0.684

3.

Question 3

If you fit a logistic regression model to a binary variable, for example use of the autolander, then fit a logistic regression model for one minus the outcome (not using the autolander) what happens to the coefficients?

1 point

The coefficients get inverted (one over their previous value).

The coefficients change in a non-linear fashion.

**The coefficients reverse their signs.**

The intercept changes sign, but the other coefficients don’t.

4.

Question 4

Consider the insect spray data \verb|InsectSprays|InsectSprays. Fit a Poisson model using spray as a factor level. Report the estimated relative rate comapring spray A (numerator) to spray B (denominator).

1 point

0.136

0.321

-0.056

**0.9457**

5.

Question 5

Consider a Poisson glm with an offset, tt. So, for example, a model of the form \verb|glm(count ~ x + offset(t), family = poisson)|glm(count ~ x + offset(t), family = poisson) where \verb|x|x is a factor variable comparing a treatment (1) to a control (0) and \verb|t|t is the natural log of a monitoring time. What is impact of the coefficient for \verb|x|x if we fit the model \verb|glm(count ~ x + offset(t2), family = poisson)|glm(count ~ x + offset(t2), family = poisson) where \verb|2 <- log(10) + t|2 <- log(10) + t? In other words, what happens to the coefficients if we change the units of the offset variable. (Note, adding log(10) on the log scale is multiplying by 10 on the original scale.)

1 point

The coefficient is subtracted by log(10).

The coefficient estimate is multiplied by 10.

The coefficient estimate is divided by 10.

**The coefficient estimate is unchanged**

6.

Question 6

Consider the data

12

x <- -5:5

y <- c(5.12, 3.93, 2.67, 1.87, 0.52, 0.08, 0.93, 2.05, 2.54, 3.87, 4.97)

Using a knot point at 0, fit a linear model that looks like a hockey stick with two lines meeting at x=0. Include an intercept term, x and the knot point term. What is the estimated slope of the line after 0?

1 point

-1.024

**1.013**

-0.183

2.037

**Peer-graded Assignment: Regression Models Course Project**