SNPcvinter {FunctanSNP} | R Documentation |
Cross-validation for SNPinter
Description
Performs K-fold cross validation for the revised partially functional interaction regression analysis over a grid of values for the regularization parameter lambda1 and lambda2.
Usage
SNPcvinter(y, z, location, X, K, lambda1, lambda2 = NULL, eta = 0,
type1, nbasis1, params1, Bsplines = 20, norder = 4,
intercept = FALSE, eps = 1e-05, maxstep = 1e+05, Plot = FALSE)
Arguments
y |
a numeric vector defining the response variables. |
z |
a matrix defining the scalar covariates, with the number of rows equal to the number of samples. |
location |
a numeric vector defining the sampling sites of the sequence data. |
X |
a matrix specifying the sequence (genotypes) data, with the number of rows equal to the number of samples. |
K |
an integer specifying the number of cross-validation folds, default is 5. |
lambda1 |
a numeric vector specifying the sparsity penalty parameter to be determined. |
lambda2 |
a numeric vector specifying the group sparsity penalty parameter to be determined. |
eta |
a numeric vector specifying the penalty parameter for smoothing analysis. |
type1 |
a character specifying the type of the basis functions that constitutes the genetic variation function. The options are "Bspline", "Exponential", "Fourier", "Monomial", and "Power". |
nbasis1 |
an integer specifying the number of basis functions that constitutes the genetic variation function. |
params1 |
in addition to rangeval1 (a vector of length 2 giving the lower and upper limits of the range of permissible values for the genetic variation function) and nbasis1, all bases have one or two parameters unique to that basis type or shared with one other;
|
Bsplines |
an integer specifying the number of basis functions that constitutes the genetic effect function. |
norder |
an integer specifying the order of bsplines that constitutes the genetic effect function, which is one higher than their degree. The default of 4 gives cubic splines. |
intercept |
should intercept(s) be fitted (TRUE) or set to zero (default = FALSE). |
eps |
a numeric variable specifying the threshold at which the algorithm terminates, default is 1e-5. |
maxstep |
a numeric variable specifying the maximum iteration steps, default is 1e5. |
Plot |
should the estimated genetic effect function beta0(t) and interaction items betak(t) be plotted (TRUE) or not (default = FALSE). |
Value
An "SNPcvinter" object that contains the list of the following items.
lambda1Select: a numeric value of the sparsity penalty parameter selected by cross validation.
lambda2Select: a numeric value of the group sparsity penalty parameter selected by cross validation.
etaSelect: a numeric value of the smoothing parameter selected by cross validation.
alpha: estimated intercept value..
gamma: estimated coefficients of the scalar covariates.
b: estimated coefficients of the chosen basis functions for the genetic effect function beta0(t) and interaction items betak(t).
betat: an "fd" object, representing the estimated genetic effect function beta(t) and interaction items betak(t).
residuals: the residuals, that is response minus fitted values.
fitted.values: the fitted mean values.
lambda1: a numeric vector specifying the sparsity penalty parameter for cross validation.
lambda2: a numeric vector specifying the group sparsity penalty parameter for cross validation.
eta: a numeric vector specifying the smoothing parameter for cross validation.
CVerror: a numeric vector, containing the mean square errors on testing set during cross validation.
See Also
See Also as simData2
, SNPinter
.
Examples
library(FunctanSNP)
n <- 300
m <- 30
simdata2 <- simData2(n, m, seed = 123)
y <- simdata2$y
z <- simdata2$z
location <- simdata2$location
X <- simdata2$X
lambda1 <- c(0.01, 0.05, 0.1)
lambda2 <- sqrt(3)*lambda1
SNPcvinterres <- SNPcvinter(y, z, location, X, K = 3, lambda1, lambda2, eta = 0,
type1 = "Bspline", nbasis1 = 5, params1 = 4, Bsplines = 5,
norder = 4, intercept = TRUE, eps = 1e-2, maxstep = 1e2, Plot = TRUE)
SNPcvinterres$lambda1Select
SNPcvinterres$lambda2Select
SNPcvinterres$alpha
SNPcvinterres$gamma
SNPcvinterres$b