EssayGhost Assignment代写，Essay代写，网课代修，Quiz代考

# EG1hao #### 数学代写案例

##### 联系我们 EssayGhost高质量代写论文定制平台

QQ：3318099838

##### 数学代写案例

In this problem, we use Salary as the response variable, and the rest 19 variables as predictors/covariates, which measure the performance of each player in season1986 and his whole career. Write R functions to perform variable selection using best subset selection partnered with BIC (Bayesian Information Criterion):1)Starting from the null model, apply the forward stepwise selection algorithmto produce a sequence of sub-models iteratively, and select a single best model using the  Plot the “BIC vs Number of Variables” curve. Present the selected model with the corresponding BIC.Math代写2)Starting from the full model (that is, the one obtained from minimizing the MSE/RSS using all the predictors), apply the backward stepwise selection algorithm to produce a sequence of sub-models iteratively, and select a single best model using the BIC. Plot the “BIC vs Number of Variables” curve. Present the selected model with the corresponding3)Are the selected models from 1) and 2) the same?Math代写Problem 2 Math代写In this problem, we fit ridge regression on the same dataset as in Problem 1. First,standardize the variables so that they are on the same scale. Next, choose a grid ofλ values ranging from λ= 1010 to λ = 10−2, essentially covering the full range of scenarios from the null model containing only the intercept, to the least squares fit. For example: grid = 10^seq(10, -2, length=100)Math代写1)Write an R function to do the following: associated with each value of λ , compute a vector of ridge regression coefficients (including the intercept), stored in a 20 × 100 matrix, with 20 rows (one for each predictor, plus an intercept) and 100 columns (one for each value ofλ).2)To find the “best”λ , use ten-fold cross-validation to choose the tuning parameter from the previous grid of values. Set a random seed – set.seed(1), firstso your results will be reproducible, since the choice of the cross-validation folds is  Plot the “Cross-Validation Error versus λ” curve, and report the selected λ.3)Finally, refit the ridge regression model on the full dataset, using the value ofλ chosen by cross-validation, and report the coefficient estimates.Math代写Remark: You should expect that none of the coefficients are zero – ridge regression does not perform variable selection.Problem 3 Math代写In this problem, we revisit the best subset selection problem. Given a responsevector Y = (

﻿