# Stanford University Statistical Learning Quiz Answer | Moving Beyond Linearity

Stanford University Statistical Learning Quiz Answer | Moving Beyond Linearity

In this article i am gone to share Stanford University Statistical Learning Quiz Answer | Moving Beyond Linearity with you..

Polynomials and Step Functions Quiz

### 7.1.R1

Which of the following can we add to linear models to capture nonlinear effects?
• Spline terms
• Polynomial terms
• Interactions
• Arbitrary linear combinations of the variables
• Step functions
Piecewise-Polynomials and Splines Quiz

### 7.2.R1

Why are natural cubic splines typically preferred over global polynomials of degree d?
• Polynomials have too many degrees of freedom
• Polynomials tend to extrapolate very badly
• Polynomials are not as continuous as splines

### 7.2.R2

Let 1{x leq t} denote a function which is 1 if x leq t and 0 otherwise.
Which of the following is a basis for linear splines with a knot at t? Select all that apply:
• 1, x, (x – t)1{x > t}
• 1, x, (x – t)1{x leq t}
• 1{x > t}, 1{x leq t}, (x – t)1{x > t}
• 1, (x – t)1{x leq t}, (x – t)1{x > t}
Smoothing Splines

### 7.3.R1

In terms of model complexity, which is more similar to a smoothing spline with 100 knots and 5 effective degrees of freedom?
• A natural cubic spline with 5 knots
• A natural cubic spline with 100 knots
Generalized Additive Models and Local Regression

### 7.4.R1

True or False: In the GAM y sim f_1(X_1) + f_2(X_2) + e, as we make f_1 and f_2 more and more complex we can approximate any regression function to arbitrary precision.
• True
• False
Nonlinear Functions in R

### 7.R.R1

Load the data from the file 7.R.RData, and plot it using plot(x,y). What is the slope coefficient in a linear regression of y on x (to within 10%)?
• -0.6748

### 7.R.R2

For the model y ~ 1+x+x^2, what is the coefficient of x (to within 10%)?
• 77.7
___________________________________________________________________________
Chapter 7 Quiz

### 7.Q.1

Suppose we want to fit a generalized additive model (with a continuous response) for y against X_1 and X_2. Suppose that we are using a cubic spline with four knots for each variable (so our model can be expressed as a linear regression after the right basis expansion).
Suppose that we fit our model by the following three steps:
1. First fit our cubic spline model for y against X_1, obtaining the fit hat f_1(x) and residuals r_i = y_i – hat f_1(X_{i,1}).
2. Then, fit a cubic spline model for r against X_2 to obtain hat f_2(x).
3. Finally construct fitted values hat y_i = hat f_1(X_{i,1}) + hat f_2(X_{i,2}).
Will we get the same fitted values as we would if we fit the additive model for y against X_1 and X_2 jointly?
• yes, no matter what
• only if X_1 and X_2 are uncorrelated
• not necessarily, even if X_1 and X_2 are uncorrelated.