Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#10 - Please Use R (e.g., RStudio) to complete this problem Assume y = 5 + 0.9x 1 + 3x 2 + . Generate data

#10 - Please Use R (e.g., RStudio) to complete this problem

Assume y = 5 + 0.9x1+ 3x2+ . Generate data with x1 norm(2, 0.52), x2 norm(1, 0.12), and x3=x1*x2,and norm(0, = 1). Use sample size n = 200.

Run the following R code:

set.seed(123) n <- 200 s <- 1 x1 <- rnorm(n, 2, 0.52) x2 <- rnorm(n, -1, 0.12) x3 <- x1*x2 e <- rnorm(n, 0, s) y <- 5 + 0.9*x1 + 3*x2 + e#true model summary(y) 

Summary(y) must produce the following, if it does not, run it again until it does:

## Min. 1st Qu. Median Mean 3rd Qu. Max. ## 0.8576 3.0472 3.9772 3.8429 4.5566 7.1697

Now, run the following code for the three models:

#Model 1 model1 <- lm(y ~ x1 + x2 + x3) summary(model1) #Model 2 model2 <- lm(y ~ x1 + x2) summary(model2) #Model 3 model3 <- lm(y ~ x1 + x3) summary(model3)

Use anova to compare model 1 and model 2. What is the pvalue for comparing these models? Enter your answer to 4 decimal places.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Calculus (Multi Variable)

Authors: Michael Sullivan

1st Edition

1464142890, 9781464142895

More Books

Students also viewed these Mathematics questions

Question

3. Avoid making mistakes when reaching our goals

Answered: 1 week ago