Description Usage Arguments Value Examples

This function fits `'splmm'`

function over grids of lambda1 and/or lambda2 and determine the best fit model based on model selection information criterion.
The function takes a scalar or a grid of lambda1 and/or lambda2 and determine the optimal tuning parameter value for the best model fit. If both lambda1 and lambda2 are inputted as scalars, an `'splmm'`

object is returned; if either or both lambda1 and lambda2 are inputted as grids, an `'splmm.tuning'`

object is returned. Currently the model selection criterion include AIC and BIC, and BIC is used to determine the optimal model.

1 2 3 4 5 | ```
splmmTuning(x, y, z, grp, lam1.seq, lam2.seq, nonpen.b=1,nonpen.L=1,
penalty.b=c("lasso","scad"),
penalty.L=c("lasso","scad"),
CovOpt=c("nlminb","optimize"),
standardize=TRUE,control=splmmControl())
``` |

`x` |
matrix of dimension N x p including the fixed-effects covariables. An intercept has to be included in the first column as (1,...,1). |

`y` |
response variable of length N. |

`z` |
random effects matrix of dimension N x q. It has to be a matrix, even if q=1. |

`grp` |
grouping variable of length N |

`lam1.seq` |
a grid of regularization parameter for fixed effects penalization, could be a scalar if no need to tune. |

`lam2.seq` |
a grid of regularization parameter for random effects penalization, could be a scalar if no need to tune. |

`nonpen.b` |
Index of indices of fixed effects not penalized. The default value is 1, which means the fixed intercept is not penalized. |

`nonpen.L` |
Index of indices of random effects not penalized. The default value is 1, which means the random intercept is not penalized. |

`penalty.b` |
The penalty method for fixed effects penalization. Currently available options include LASSO penalty and SCAD penalty. |

`penalty.L` |
The penalty method for fixed effects penalization. Currently available options include LASSO penalty and SCAD penalty. |

`CovOpt` |
which optimization routine should be used for updating the variance parameter. The available options include optimize and nlminb. nlminb uses the estimate of the last iteration as a starting value. nlminb is faster if there are many Gauss-Seidel iterations. |

`standardize` |
A logical parameter specifying whether the fixed effects matrix x and random effects matrix z should be standardized such that each column has mean 0 and standard deviation 1. The default value is |

`control` |
control parameters for the algorithm and the Armijo Rule, see |

A `'splmm.tuning'`

object is returned, for which `plot`

method exist.

`lam1.seq` |
lambda1 grid used for tuning. Only available when lambda1 is inputted as a vector. |

`lam2.seq` |
lambda2 grid used for tuning. Only available when lambda2 is inputted as a vector. |

`BIC.lam1` |
A vector of BIC values of splmm models fitting over a lambda1 grid. |

`BIC.lam2` |
A vector of BIC values of splmm models fitting over a lambda2 grid. |

`fit.BIC` |
An array of BIC values of splmm models fitting over lambda 1 grid x lambda2 grid. |

`AIC.lam1` |
A vector of AIC values of splmm models fitting over a lambda1 grid. |

`AIC.lam2` |
A vector of AIC values of splmm models fitting over a lambda2 grid. |

`fit.AIC` |
An array of AIC values of splmm models fitting over lambda 1 grid x lambda2 grid. |

`BICC.lam1` |
A vector of BICC values of splmm models fitting over a lambda1 grid. |

`BICC.lam2` |
A vector of BICC values of splmm models fitting over a lambda2 grid. |

`fit.BICC` |
An array of BICC values of splmm models fitting over lambda 1 grid x lambda2 grid. |

`EBIC.lam1` |
A vector of EBIC values of splmm models fitting over a lambda1 grid. |

`EBIC.lam2` |
A vector of EBIC values of splmm models fitting over a lambda2 grid. |

`fit.EBIC` |
An array of EBIC values of splmm models fitting over lambda 1 grid x lambda2 grid. |

`min.BIC` |
The minimum BIC value from tuning over a grid. This is only available when either lambda1 or lambda2 is a scalar. |

`min.AIC` |
The minimum AIC value from tuning over a grid. This is only available when either lambda1 or lambda2 is a scalar. |

`min.BICC` |
The minimum BICC value from tuning over a grid. This is only available when either lambda1 or lambda2 is a scalar. |

`min.EBIC` |
The minimum EBIC value from tuning over a grid. This is only available when either lambda1 or lambda2 is a scalar. |

`best.model` |
The index of the optimal model. This is only available when either lambda1 or lambda2 is a scalar. |

`best.fit` |
The optimal model chosen by the minimum BIC as an |

`min.lam1` |
lambda1 value that results in the optimal model. This is only available when input lambda1 is a vector. |

`min.lam2` |
lambda2 value that results in the optimal model. This is only available when input lambda2 is a vector. |

`lam1.tuning` |
A |

`lam2.tuning` |
A |

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 | ```
data(cognitive)
x <- model.matrix(ravens ~schoolid+treatment+year+sex+age_at_time0
+height+weight+head_circ+ses+mom_read+mom_write
+mom_edu, cognitive)
z <- x
## Tuning over lambda1 grid
lam1 = seq(0.1,0.5,0.1)
lam2 = 0.1
fit1 <-splmmTuning(x=x,y=cognitive$ravens,z=z,grp=cognitive$id,lam1.seq=lam1,
lam2.seq=lam2,penalty.b="scad", penalty.L="scad")
plot.splmm(fit1)
## Tuning over lambda2 grid
lam1 = 0.1
lam2 = seq(0.1,0.5,0.1)
fit2 <-splmmTuning(x=x,y=cognitive$ravens,z=z,grp=cognitive$id,lam1.seq=lam1,
lam2.seq=lam2,penalty.b="scad", penalty.L="scad")
plot.splmm(fit2)
## Tuning over both lambda1 and lambda2 grid
lam1 = seq(0.1,0.5,0.2)
lam2 = seq(0.1,0.5,0.2)
fit3 <-splmmTuning(x=x,y=cognitive$ravens,z=z,grp=cognitive$id,lam1.seq=lam1,
lam2.seq=lam2,penalty.b="scad", penalty.L="scad")
plot.splmm(fit3)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.