Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

First, run the following code in the R Console. The update function takes an existing fitted model and updates it. The notation . ~ .

First, run the following code in the R Console. The update function takes an existing fitted model and

updates it. The notation . ~ . + var means keep the existing response and regressors but add var to the

model.

# fit model with an intercept

lmod1 <- lm(lpsa ~ 1, data = prostate)

summary(lmod1)$r.squared

# fit model with an intercept and lcavol

lmod2 <- update(lmod1, . ~ . + lcavol, data = prostate)

summary(lmod2)$r.squared

# fit model with an intercept, lcavol, and lweight

lmod3 <- update(lmod2, . ~ . + lweight, data = prostate)

summary(lmod3)$r.squared

# fit model with an intercept, lcavol, lweight, and age

lmod4 <- update(lmod3, . ~ . + age, data = prostate)

summary(lmod4)$r.squared

lmod5 <- update(lmod4, . ~ . + lbph, data = prostate)

summary(lmod5)$r.squared

lmod6 <- update(lmod5, . ~ . + svi, data = prostate)

summary(lmod6)$r.squared

lmod7 <- update(lmod6, . ~ . + lcp, data = prostate)

summary(lmod7)$r.squared

lmod8 <- update(lmod7, . ~ . + gleason, data = prostate)

summary(lmod8)$r.squared

lmod9 <- update(lmod7, . ~ . + rnorm(97), data = prostate)

summary(lmod9)$r.squared

(a)

Complete a table with the results from the code above with the following format. Replace x with the R2

value from the fitted model.

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

Step: 3

blur-text-image

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

New Trends In Shape Optimization

Authors: Aldo Pratelli, Günter Leugering

1st Edition

3319175637, 9783319175638

More Books

Students also viewed these Mathematics questions