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;

  • bspline: Argument norder = the order of the spline, which is one more than the degree of the polynomials used. This defaults to 4, which gives cubic splines.

  • exponential: Argument ratevec. In fda_2.0.2, this defaulted to 1. In fda_2.0.3, it will default to 0:1.

  • fourier: Argument period defaults to diff(rangeval).

  • monomial/power: Argument exponents. Default = 0:(nbasis-1). For monomial bases, exponents must be distinct nonnegative integers. For power bases, they must be distinct real numbers.

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.

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


[Package FunctanSNP version 0.1.0 Index]