Description Usage Arguments Value References Examples
This function implements Kfold crossvalidation for sparse frequentist generalized additive models (GAMs) with the group LASSO, group SCAD, and group MCP penalties. The identity link function is used for Gaussian GAMs, the logit link is used for binomial GAMs, and the log link is used for Poisson, negative binomial, and gamma GAMs.
1 2 3 4 
y 
n \times 1 vector of responses. 
X 
n \times p design matrix, where the jth column of 
df 
number of Bspline basis functions to use in each basis expansion. Default is 
family 
exponential dispersion family. Allows for 
nb.size 
known size parameter α in NB(α,μ_i) distribution for negative binomial responses. Default is 
gamma.shape 
known shape parameter ν in Gamma(μ_i,ν) distribution for gamma responses. Default is 
penalty 
group regularization method to use on the groups of basis coefficients. The options are 
taper 
tapering term γ in group SCAD and group MCP controlling how rapidly the penalty tapers off. Default is 
nfolds 
number of folds K to use in Kfold crossvalidation. Default is 
nlambda 
number of regularization parameters L. Default is 
lambda 
grid of L regularization parameters. The user may specify either a scalar or a vector. If the user does not provide this, the program chooses the grid automatically. 
max.iter 
maximum number of iterations in the algorithm. Default is 
tol 
convergence threshold for algorithm. Default is 
The function returns a list containing the following components:
lambda 
L \times 1 vector of regularization parameters 
cve 
L \times 1 vector of mean crossvalidation error across all K folds. The kth entry in 
cvse 
L \times 1 vector of standard errors for crossvalidation error across all K folds. The kth entry in 
lambda.min 
value of 
Breheny, P. and Huang, J. (2015). "Group descent algorithms for nonconvex penalized linear and logistic regression models with grouped predictors." Statistics and Computing, 25:173187.
Wang, H. and Leng, C. (2007). "Unified LASSO estimation by least squares approximation." Journal of the American Statistical Association, 102:10391048.
Yuan, M. and Lin, Y. (2006). Model selection and estimation in regression with grouped variables. Journal of the Royal Statistical Society: Series B (Statistical Methodology), 68: 4967.
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  ## Generate data
set.seed(12345)
X = matrix(runif(100*20), nrow=100)
n = dim(X)[1]
y = 5*sin(2*pi*X[,1])5*cos(2*pi*X[,2]) + rnorm(n)
## Test data with 50 observations
X.test = matrix(runif(50*20), nrow=50)
## Fit sparse Gaussian generalized additive model to data with the MCP penalty
gam.mod = SFGAM(y, X, X.test, family="gaussian", penalty="gMCP")
## The model corresponding to the 75th tuning parameter
gam.mod$lambda[75]
gam.mod$classifications[,75] ## The covariate index is listed first
## Plot first function f_1(x_1) in 75th model
x1 = X.test[,1]
## Estimates of all 20 function evaluations on test data
f.hat = gam.mod$f.pred[[75]]
## Extract estimates of f_1
f1.hat = f.hat[,1]
## Plot X_1 against f_1(x_1)
plot(x1[order(x1)], f1.hat[order(x1)], xlab=expression(x[1]),
ylab=expression(f[1](x[1])))

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.