Business Finance Homework Help

WMU Coefficient of Hp Questions

 

I’m working on a data analytics test / quiz prep and need an explanation and answer to help me learn.

Problem 1. Use lm() to regress wt against hp in the mtcars data set.

Name your model “fit”

Use summary(fit) to view results

What is the coefficient of hp? (Answer up to 4 decimal places)

What is the p-value for a t-test that this coefficient is zero? (Answer in exact form from R e.g., 2.18e-08)

Interpretation: What is average difference in weight (wt) per unit of horsepower (hp)?

Recommended exercise: Use “plot(wt ~ hp)” and “lines(hp, predict(fit))” to show data points and OLS line (prediction model)

Problem 2. Predict the average value of wt for cars with hp = 200, with 95% confidence intervals. What is the upper 95% UCL? (Answer up to 3 decimal places.)

–Hint 1 (use only if you need it): attach(mtcars), then fit a linear model using lm() and name it. Use new.dat <- data.frame(hp = 200) to create new.dat value. Finally, use predict() with 3 appropriate arguments to get the answer.

  • Hint 2: The middle argument is: newdata = new.dat

Use the same model to predict the expected value and range of values (95% prediction interval) of wt for a randomly selected car with hp = 200. What is the upper 95% prediction limit (UPL)?

(Answer up to 3 decimal places.)

Problem 3. Use lm() to regress mpg against am (1 = manual, 0 = automatic transmission) in the mtcars data set.

Assign your model the name “fit” (using <- or =)

Use summary(fit) to view results

am is a “dummy variable” (0-1, indicating factor level)

What is the coefficient of am? (Answer up to three decimal places)

Interpretation: What is the average difference in mpg between cars with manual and automatic transmissions in themtcars data set?

What is the p-value for a t-test of whether the coefficient of am is 0? (Answer up to 6 decimal places)

Problem 4. Calculate Kendall’s tau and the Pearson’s correlation coefficient between Weight and Sodium in Data and test whether each is different from 0 at a = 0.05.

Hint: Look at help(cor.test) if needed

What is the p-value for Kendall’s tau? (Answer in the exact form in R e.g., 0.00e-00)

What is the p-value for the Pearson’s correlation coefficient? (Answer in the exact form in R e.g., 0.00e-00)

–Ignore warning message due to ties.

Which test do you think is more reliable? Why?

Problem 5. Attach the mtcars data frame

Compare the outputs from

summary(lm(qsec~mpg)) and summary(sm(qsec~mpg))

But first: install.packages(“npreg”); library(npreg)

Using summary(sm(qsec~mpg)), what is the value of the “Adjusted R-squared” for the smoothing regression model sm(qsec~mpg)?

Adjusted R2 adjusts for the number of independent predictors, k, to help correct for over-fitting

(Answer up to 4 decimal places)

Problem 6. For data frame mtcars, create an MLR model for predicting acceleration (qsec) from wt, disp, hp, and am

What percent of variance in qsec is explained by these four predictors? (What is Adjusted R-squared?) (Answer up to 3 decimal places)

–Does the MLR model provide an acceptable (not clearly mistaken) description of the data? What is the p-value for the “Global Stat.” test when gvlma() is used to test MLR assumptions? (Answer up to 3 decimal places)

–Using your MLR model, predict acceleration (qsec) for a car with wt = 2.7 half-tons, disp = 230, hp= 150, am = 0. (Answer up to 2 decimal places)

–Using your MLR model, predict acceleration (qsec) for a car with wt = 2.5 half-tons, disp = 230, hp= 150, am = 1. (Answer up to 2 decimal places)

Problem 7. Create a multiple logistic regression model for the binary variable low (dependent variable) in data frame birthwt in package MASS, using all other variables except bwt as predictors (independent variables)

What is the smallest p-value for any of the predictors? (Answer up to 5 decimal places)

–In Pima example, it was 3.24e-11, for glucose

Hint:

library(MASS); attach(birthwt); names(birthwt)

# Start your logistic regression command with: model <- glm(low ~.-bwt)