A few question related to R

Description

The Ozone Dataset

Don't use plagiarized sources. Get Your Custom Assignment on
A few question related to R
From as Little as $13/Page

The Ozone data was created in a study of the relationship between atmospheric ozone concentration and meteorology in the Los Angeles Basin in 1976. A number of cases with missing variables have been removed for simplicity.

The data frame has 330 observations on the following 10 variables:

O3: Ozone conc., ppm, at Sandbug AFB
vh: a numeric vector
wind: wind speed
humidity: a numeric vector
temp: temperature
ibh: inversion base height
dpg: Daggett pressure gradient
ibt: a numeric vector
vis: visibility
doy: day of the year

You can access the data frame using the following statement: data(ozone, package = “faraway”)

Question 1

Fit a model with O3 as the outcome and temp and humidity as predictors. Which coefficients are significant at the 5% level?

Question 2

Fit the same model but add an interaction between temp and humidity.

Has the adjusted R2 increased compared to the previous model?

Is the interaction coefficient significant?

Is the temp variable significant?

Should we remove the temp variable while keeping the interaction?

Hint: use * to define an interaction term. See and refer to Lesson 8, Slide 50.

Question 3

Create a standardized residuals vs fitted plot. Do you detect any issues?

Hint: See Lesson 6. Slide 11.

Question 4

Create a Q-Q plot and histogram of the standardized residuals. Do you see any issues?

Hint: See Lesson 6, Slide 26.

Question 5

Use the Box-Cox method to find the optimal exponent for a power transformation of the outcome. What is the exponent that you found?

Hint: See Lesson 8, Slide 14.

Question 6

Create a new variable for the transformed outcome based on the maximum likelihood exponent and fit a new model with the same predictors (including the interaction term). Show the regression output.

Hint: See Lesson 8, Slide 21.

Question 7

Create a standardized residuals vs fitted plot for the new model. Do you see any difference compared to the previous plot?

Question 8

Create a Q-Q plot and histogram of the standardized residuals for the new model. Do you see any difference compared to the previous plot and histogram?

Please help me solve these question based on the file I provided. Thank you!


Unformatted Attachment Preview

Regression 1: Linear Regression and Modeling
Lesson 8: Transformations
(Version: 12-March-2024)
Erez Hatna
School of Global Public Health
New York University
Objectives
Part 1: Log Transformations
Part 2: Box-Cox Transformation
Part 3: Transformations with Polynomials
Part 4: Interaction Between Two Numerical Predictors
Part 1: Log Transformations
Transformations
Transformations of the response and/or predictors can:
• Improve the fit of the model
• Correct violations of model assumptions such as non-constant error variance.
We may also consider including additional predictors that are functions of the existing
predictors, like quadratic or cross-product terms (interactions).
Log Transforming the Response
Suppose that you are contemplating a logged response in a simple regression situation:
log = 0 + 1 +
Illustration for ≈ +
In the original scale of the response, this model becomes:
y=
0 + 1

• In this model, the errors enter multiplicatively and not additively as they
usually do.
• The use of standard regression methods for the logged response model
requires that we believe the errors enter multiplicatively in the original scale.
• For small errors: ≈ 1 + ϵ
• Substituting this into the second equation gives:
y = 0 + 1 ∙ 1 + = 0 + 1 + ∙ 0 + 1
• This model has additive errors but non-constant variance because is
multiplied by 0+ 1 .
error
Purchase answer to see full
attachment