predict.boss: Prediction given new data entries. In BOSSreg: Best Orthogonalized Subset Selection (BOSS)

Description

This function returns the prediction(s) given new observation(s), for BOSS, where the optimal coefficient vector is chosen via certain selection rule.

Usage

 ```1 2``` ```## S3 method for class 'boss' predict(object, newx, ...) ```

Arguments

 `object` The boss object, returned from calling 'boss' function. `newx` A new data entry or several entries. It can be a vector, or a matrix with `nrow(newx)` being the number of new entries and `ncol(newx)=p` being the number of predictors. The function takes care of the intercept, NO need to add `1` to `newx`. `...` Extra arguments to be plugged into `coef`, such as `select.boss`, see the description of `coef.boss` for more details.

Details

The function basically calculates x * coef, where `coef` is a coefficient vector chosen by a selection rule. See more details about the default and available choices of the selection rule in the description of `coef.boss`.

Value

The prediction(s) for BOSS.

Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29``` ```## Generate a trivial dataset, X has mean 0 and norm 1, y has mean 0 set.seed(11) n = 20 p = 5 x = matrix(rnorm(n*p), nrow=n, ncol=p) x = scale(x, center = colMeans(x)) x = scale(x, scale = sqrt(colSums(x^2))) beta = c(1, 1, 0, 0, 0) y = x%*%beta + scale(rnorm(n, sd=0.01), center = TRUE, scale = FALSE) ## Fit the model boss_result = boss(x, y) ## Get the coefficient vector selected by AICc-hdf (S3 method for boss) beta_boss_aicc = coef(boss_result) # the above is equivalent to the following beta_boss_aicc = boss_result\$beta_boss[, which.min(boss_result\$IC_boss\$aicc), drop=FALSE] ## Get the fitted values of BOSS-AICc-hdf (S3 method for boss) mu_boss_aicc = predict(boss_result, newx=x) # the above is equivalent to the following mu_boss_aicc = cbind(1,x) %*% beta_boss_aicc ## Repeat the above process, but using Cp-hdf instead of AICc-hdf ## coefficient vector beta_boss_cp = coef(boss_result, method.boss='cp') beta_boss_cp = boss_result\$beta_boss[, which.min(boss_result\$IC_boss\$cp), drop=FALSE] ## fitted values of BOSS-Cp-hdf mu_boss_cp = predict(boss_result, newx=x, method.boss='cp') mu_boss_cp = cbind(1,x) %*% beta_boss_cp ```

Example output

```
```

BOSSreg documentation built on March 7, 2021, 1:06 a.m.