Title: | Functional Analysis (with Interactions) for Dense SNP Data |
---|---|
Description: | An implementation of revised functional regression models for multiple genetic variation data, such as single nucleotide polymorphism (SNP) data, which provides revised functional linear regression models, partially functional interaction regression analysis with penalty-based techniques and corresponding drawing functions, etc.(Ruzong Fan, Yifan Wang, James L. Mills, Alexander F. Wilson, Joan E. Bailey-Wilson, and Momiao Xiong (2013) <doi:10.1002/gepi.21757>). |
Authors: | Rui Ren [aut, cre], Kuangnan Fang [aut], Qingzhao Zhang [aut], Shuangge Ma [aut] |
Maintainer: | Rui Ren <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.1.0 |
Built: | 2024-12-21 06:50:13 UTC |
Source: | CRAN |
This functions predicts coefficients and related coefficient functions from a fitted "SNPlm" or "SNPinter" object.
coefSNPreg(x)
coefSNPreg(x)
x |
An "coef.SNPreg" object that contains the list of the following items.
alpha: estimated intercept value.
gamma: estimated coefficients of the scalar covariates.
b: estimated coefficients of the chosen basis functions for the genetic effect function beta(t) (and interaction items betak(t), if x is an "SNPinter" object).
betat: an "fd" object, representing the estimated genetic effect function beta(t).
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123) SNPlmres <- SNPlm(y = simdata1$y, z = simdata1$z, location = simdata1$location, X = simdata1$X, type1 = "Bspline", type2 = "Bspline", nbasis1 = 5, nbasis2 = 5, params1 = 4, params2 = 4, intercept = FALSE, Plot = FALSE) coef1 <- coefSNPreg(x = SNPlmres) coef1$alpha ###intercept coef1$gamma ###coefficients of scalar variables coef1$b ###coefficients of basis functions simdata2 <- simData2(n, m, seed = 123) lambda1 <- 0.05 lambda2 <- sqrt(3)*lambda1 eta <- 0 SNPinterres <- SNPinter(y = simdata2$y, z = simdata2$z, location = simdata2$location, X = simdata2$X, lambda1, lambda2, eta, type1 = "Bspline", nbasis1 = 5, params1 = 4, Bsplines = 5, norder = 4, intercept = TRUE, eps = 1e-2, maxstep = 1e2, Plot = FALSE) coef2 <- coefSNPreg(x = SNPinterres) coef2$alpha ###intercept coef2$gamma ###coefficients of scalar variables coef2$b ###coefficients of basis functions
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123) SNPlmres <- SNPlm(y = simdata1$y, z = simdata1$z, location = simdata1$location, X = simdata1$X, type1 = "Bspline", type2 = "Bspline", nbasis1 = 5, nbasis2 = 5, params1 = 4, params2 = 4, intercept = FALSE, Plot = FALSE) coef1 <- coefSNPreg(x = SNPlmres) coef1$alpha ###intercept coef1$gamma ###coefficients of scalar variables coef1$b ###coefficients of basis functions simdata2 <- simData2(n, m, seed = 123) lambda1 <- 0.05 lambda2 <- sqrt(3)*lambda1 eta <- 0 SNPinterres <- SNPinter(y = simdata2$y, z = simdata2$z, location = simdata2$location, X = simdata2$X, lambda1, lambda2, eta, type1 = "Bspline", nbasis1 = 5, params1 = 4, Bsplines = 5, norder = 4, intercept = TRUE, eps = 1e-2, maxstep = 1e2, Plot = FALSE) coef2 <- coefSNPreg(x = SNPinterres) coef2$alpha ###intercept coef2$gamma ###coefficients of scalar variables coef2$b ###coefficients of basis functions
Plot the estimated genetic variant function obtained by SNPgvf or a given functional data object(s).
plotGVF(x, y = NULL, Lfdobj = 0, href = TRUE, titles = NULL, xlim = NULL, ylim = NULL, xlab = NULL, ylab = NULL, ask = FALSE, nx = NULL, axes = NULL)
plotGVF(x, y = NULL, Lfdobj = 0, href = TRUE, titles = NULL, xlim = NULL, ylim = NULL, xlab = NULL, ylab = NULL, ask = FALSE, nx = NULL, axes = NULL)
x |
functional data object(s) to be plotted, such as the estimated genetic variant function obtained by SNPgvf. |
y |
sequence of points at which to evaluate the functions 'x' and plot on the horizontal axis. Defaults to seq(rangex[1], rangex[2], length = nx). |
Lfdobj |
either a nonnegative integer or a linear differential operator object. If present, the derivative or the value of applying the operator is plotted rather than the functions themselves. |
href |
a logical variable: If TRUE, add a horizontal reference line at 0. |
titles |
a vector of strings for identifying curves |
xlim |
a vector of length 2 containing axis limits for the horizontal axis. |
ylim |
a vector of length 2 containing axis limits for the vertical axis. |
xlab |
a label for the horizontal axis. |
ylab |
a label for the vertical axis. |
ask |
a logical value: If TRUE, each curve is shown separately, and the plot advances with a mouse click |
nx |
the number of points to use to define the plot. The default is usually enough, but for a highly variable function more may be required. |
axes |
Either a logical or a list or NULL.
|
plot the estimated genetic variant function.
See Also as SNPgvf
.
library(FunctanSNP) n <- 20 m <- 50 simdata <- simX(n, m, seed = 1, d.ratio = 0) X <- simdata$X location <- simdata$location SNPgvfres <- SNPgvf(location, X, type = "Bspline", nbasis = 5, params = 4, Plot = FALSE) plotGVF(SNPgvfres)
library(FunctanSNP) n <- 20 m <- 50 simdata <- simX(n, m, seed = 1, d.ratio = 0) X <- simdata$X location <- simdata$location SNPgvfres <- SNPgvf(location, X, type = "Bspline", nbasis = 5, params = 4, Plot = FALSE) plotGVF(SNPgvfres)
Display the sequence data, such as the data generated by simX. The horizontal axis represents the sampling sites, and the vertical axis represents the sequence values containing only 0, 1 and 2.
plotRawdata(location, X, color = NULL, pch = 16, cex = 0.9)
plotRawdata(location, X, color = NULL, pch = 16, cex = 0.9)
location |
a numeric vector defining the sampling sites of the sequence data. |
X |
a matrix specifying the sequence data, with the number of rows equal to the number of samples. |
color |
A specification for the default plotting color. See graphical parameters ( |
pch |
Either an integer specifying a symbol or a single character to be used as the default in plotting points. See graphical parameters ( |
cex |
A numerical value giving the amount by which plotting text and symbols should be magnified relative to the default. See graphical parameters ( |
show the sequence data.
library(FunctanSNP) n <- 20 m <- 50 simdata <- simX(n, m, seed = 1, d.ratio = 0) X <- simdata$X location <- simdata$location plotRawdata(location, X = X[1:2, ])
library(FunctanSNP) n <- 20 m <- 50 simdata <- simX(n, m, seed = 1, d.ratio = 0) X <- simdata$X location <- simdata$location plotRawdata(location, X = X[1:2, ])
Produces a residual diagram or a plot of the genetic effect function beta(t) (and interaction items betak(t), if the entry x is an "SNPinter" object) for a fitted "SNPlm" or "SNPinter" object.
plotSNPreg(x, type)
plotSNPreg(x, type)
x |
|
type |
character, "beta" or "residuals" type, if "beta", plot the genetic effect function beta0(t) (and interaction items betak(t), if the entry x is an "SNPinter" object), if "residuals", show the residual plot. |
show the residual plot or coefficient functions.
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123) SNPlmres <- SNPlm(y = simdata1$y, z = simdata1$z, location = simdata1$location, X = simdata1$X, type1 = "Bspline", type2 = "Bspline", nbasis1 = 5, nbasis2 = 5, params1 = 4, params2 = 4, intercept = FALSE, Plot = FALSE) plotSNPreg(x = SNPlmres, type = "beta") plotSNPreg(x = SNPlmres, type = "residuals") simdata2 <- simData2(n, m, seed = 123) lambda1 <- 0.05 lambda2 <- sqrt(3)*lambda1 eta <- 0 SNPinterres <- SNPinter(y = simdata2$y, z = simdata2$z, location = simdata2$location, X = simdata2$X, lambda1, lambda2, eta, type1 = "Bspline", nbasis1 = 5, params1 = 4, Bsplines = 5, norder = 4, intercept = TRUE, eps = 1e-2, maxstep = 1e2, Plot = FALSE) plotSNPreg(x = SNPinterres, type = "beta") plotSNPreg(x = SNPinterres, type = "residuals")
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123) SNPlmres <- SNPlm(y = simdata1$y, z = simdata1$z, location = simdata1$location, X = simdata1$X, type1 = "Bspline", type2 = "Bspline", nbasis1 = 5, nbasis2 = 5, params1 = 4, params2 = 4, intercept = FALSE, Plot = FALSE) plotSNPreg(x = SNPlmres, type = "beta") plotSNPreg(x = SNPlmres, type = "residuals") simdata2 <- simData2(n, m, seed = 123) lambda1 <- 0.05 lambda2 <- sqrt(3)*lambda1 eta <- 0 SNPinterres <- SNPinter(y = simdata2$y, z = simdata2$z, location = simdata2$location, X = simdata2$X, lambda1, lambda2, eta, type1 = "Bspline", nbasis1 = 5, params1 = 4, Bsplines = 5, norder = 4, intercept = TRUE, eps = 1e-2, maxstep = 1e2, Plot = FALSE) plotSNPreg(x = SNPinterres, type = "beta") plotSNPreg(x = SNPinterres, type = "residuals")
This functions predicts fitted values for newly entered data from a fitted "SNPlm" or "SNPinter" object.
predictSNPreg(x, newz, newX)
predictSNPreg(x, newz, newX)
x |
|
newz |
matrix of new values for z at which predictions are to be made. |
newX |
matrix of new values for X at which predictions are to be made. |
predicted.values: the predicted mean values.
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123) SNPlmres <- SNPlm(y = simdata1$y[1:200], z = simdata1$z[1:200, ], location = simdata1$location, X = simdata1$X[1:200, ], type1 = "Bspline", type2 = "Bspline", nbasis1 = 5, nbasis2 = 5, params1 = 4, params2 = 4, intercept = FALSE, Plot = FALSE) predict.values1 <- predictSNPreg(x = SNPlmres, newz = simdata1$z[-(1:200), ], newX = simdata1$X[-(1:200), ]) simdata2 <- simData2(n, m, seed = 123) lambda1 <- 0.05 lambda2 <- sqrt(3)*lambda1 eta <- 0 SNPinterres <- SNPinter(y = simdata2$y[1:200], z = simdata2$z[1:200, ], location = simdata2$location, X = simdata2$X[1:200, ], lambda1, lambda2, eta, type1 = "Bspline", nbasis1 = 5, params1 = 4, Bsplines = 5, norder = 4, intercept = TRUE, eps = 1e-2, maxstep = 1e2, Plot = FALSE) predict.values2 <- predictSNPreg(x = SNPinterres, newz = simdata2$z[-(1:200), ], newX = simdata2$X[-(1:200), ])
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123) SNPlmres <- SNPlm(y = simdata1$y[1:200], z = simdata1$z[1:200, ], location = simdata1$location, X = simdata1$X[1:200, ], type1 = "Bspline", type2 = "Bspline", nbasis1 = 5, nbasis2 = 5, params1 = 4, params2 = 4, intercept = FALSE, Plot = FALSE) predict.values1 <- predictSNPreg(x = SNPlmres, newz = simdata1$z[-(1:200), ], newX = simdata1$X[-(1:200), ]) simdata2 <- simData2(n, m, seed = 123) lambda1 <- 0.05 lambda2 <- sqrt(3)*lambda1 eta <- 0 SNPinterres <- SNPinter(y = simdata2$y[1:200], z = simdata2$z[1:200, ], location = simdata2$location, X = simdata2$X[1:200, ], lambda1, lambda2, eta, type1 = "Bspline", nbasis1 = 5, params1 = 4, Bsplines = 5, norder = 4, intercept = TRUE, eps = 1e-2, maxstep = 1e2, Plot = FALSE) predict.values2 <- predictSNPreg(x = SNPinterres, newz = simdata2$z[-(1:200), ], newX = simdata2$X[-(1:200), ])
SNPlm
Generate simulated data for users to apply the method SNPlm, including response variable y, scalar variable Z and sequence (genotypes) data X.
simData1(n, m, seed)
simData1(n, m, seed)
n |
an interger variable specifying the number of samples to be generated. |
m |
an interger variable specifying the sequence length of each sample. |
seed |
an integer variable specifying the random seed used for random sequence generation. |
An "simData1" object that contains the list of the following items.
y: a numeric vector representing the response variables.
z: a matrix representing 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 (genotypes) data.
X: a matrix representing the sequence data, with the number of rows equal to the number of samples.
beta: an "fd" object, representing the genetic effect function.
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123)
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123)
SNPinter
and SNPcvinter
Generate simulated data for users to apply the method SNPinter and SNPcvinter, including response variable y, scalar variable Z and sequence (genotypes) data X.
simData2(n, m, seed)
simData2(n, m, seed)
n |
an interger variable specifying the number of samples to be generated. |
m |
an interger variable specifying the sequence length of each sample. |
seed |
an integer variable specifyinging the random seed used for random sequence generation. |
An "simData2" object that contains the list of the following items.
y: a numeric vector representing the response variables.
z: a matrix representing 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 (genotypes) data.
X: a matrix representing the sequence data, with the number of rows equal to the number of samples.
beta: an "fd" object specifying the genetic effect function.
See Also as simData1
, SNPinter
, SNPcvinter
.
library(FunctanSNP) n <- 300 m <- 30 simdata2 <- simData2(n, m, seed = 123)
library(FunctanSNP) n <- 300 m <- 30 simdata2 <- simData2(n, m, seed = 123)
This function provides a method for generating sequence data containing only 0, 1 and 2, which can be used to simulate the generation of sequence genotypes.
simX(n, m, seed = 1, d.ratio = 0)
simX(n, m, seed = 1, d.ratio = 0)
n |
an interger variable specifying the number of samples to be generated. |
m |
an interger variable specifying the sequence length of each sample. |
seed |
an integer variable specifying the random seed used for random sequence generation. |
d.ratio |
a numeric variable between 0 and 1 indicating the deletion ratio of sample sequences, default value is 0. |
An "simX" object that contains the list of the following items.
location: a numeric vector defining the sampling sites of the sequence data.
X: a matrix with n rows and m columns representing the sequence data.
See Also as plotRawdata
, SNPgvf
.
library(FunctanSNP) n <- 2 m <- 50 simdata1 <- simX(n, m, seed = 1, d.ratio = 0) simdata2 <- simX(n, m, seed = 1, d.ratio = 0.3) plotRawdata(location = simdata1$location, X = simdata1$X) plotRawdata(location = simdata2$location, X = simdata2$X)
library(FunctanSNP) n <- 2 m <- 50 simdata1 <- simX(n, m, seed = 1, d.ratio = 0) simdata2 <- simX(n, m, seed = 1, d.ratio = 0.3) plotRawdata(location = simdata1$location, X = simdata1$X) plotRawdata(location = simdata2$location, X = simdata2$X)
SNPinter
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.
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)
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)
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). |
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 as simData2
, SNPinter
.
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
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
This function conducts the ordinary linear square smoothing analysis and models the genotypes of an individual (such as the sequence data generated by simX containing only 0, 1, 2) as the genetic variant function X(t).
SNPgvf(location, X, type, nbasis, params, Plot = FALSE)
SNPgvf(location, X, type, nbasis, params, Plot = FALSE)
location |
a numeric vector defining the sampling sites of the sequence data. |
X |
a matrix specifyinging the sequence data, with the number of rows equal to the number of samples. |
type |
a character specifying the type of the basis functions. The options are "Bspline", "Exponential", "Fourier", "Monomial", and "Power". |
nbasis |
an integer specifying the number of basis functions. |
params |
in addition to rangeval (a vector of length 2 giving the lower and upper limits of the range of permissible values for the function) and nbasis, all bases have one or two parameters unique to that basis type or shared with one other:
|
Plot |
should the estimated genetic variant function X(t) be plotted (TRUE) or not (default = FALSE). |
An 'fd' object that contains the estimated genetic variant function.
See Also as simX
, plotRawdata
.
library(FunctanSNP) n <- 20 m <- 50 simdata <- simX(n, m, seed = 1, d.ratio = 0) X <- simdata$X location <- simdata$location SNPgvfres <- SNPgvf(location, X, type = "Bspline", nbasis = 5, params = 4, Plot = FALSE) plotRawdata(location, X) plotGVF(SNPgvfres)
library(FunctanSNP) n <- 20 m <- 50 simdata <- simX(n, m, seed = 1, d.ratio = 0) X <- simdata$X location <- simdata$location SNPgvfres <- SNPgvf(location, X, type = "Bspline", nbasis = 5, params = 4, Plot = FALSE) plotRawdata(location, X) plotGVF(SNPgvfres)
This function conducts joint analysis, which includes all scalar covariates Z, genetic variant function X(t), and their interactions in a partially functional interaction regression model. In addition, this function identifies the relevant genetic variation sites with a local sparsity penalty-based method.
SNPinter(y, z, location, X, lambda1, lambda2 = NULL, eta, type1, nbasis1, params1, Bsplines = 20, norder = 4, intercept = FALSE, eps = 1e-05, maxstep = 1e+05, Plot = FALSE)
SNPinter(y, z, location, X, lambda1, lambda2 = NULL, eta, type1, nbasis1, params1, Bsplines = 20, norder = 4, intercept = FALSE, eps = 1e-05, maxstep = 1e+05, Plot = FALSE)
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. |
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). |
An "SNPinter" object that contains the list of the following items.
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.
See Also as simData1
, SNPcvinter
.
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 <- 0.05 lambda2 <- sqrt(3)*lambda1 eta <- 0 SNPinterres <- SNPinter(y, z, location, X, lambda1, lambda2, eta, type1 = "Bspline", nbasis1 = 5, params1 = 4, Bsplines = 5, norder = 4, intercept = TRUE, eps = 1e-2, maxstep = 1e2, Plot = TRUE) SNPinterres$alpha SNPinterres$gamma SNPinterres$b
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 <- 0.05 lambda2 <- sqrt(3)*lambda1 eta <- 0 SNPinterres <- SNPinter(y, z, location, X, lambda1, lambda2, eta, type1 = "Bspline", nbasis1 = 5, params1 = 4, Bsplines = 5, norder = 4, intercept = TRUE, eps = 1e-2, maxstep = 1e2, Plot = TRUE) SNPinterres$alpha SNPinterres$gamma SNPinterres$b
This function models the genetic effect of genetic variants by relating the genetic variant function to the phenotype adjusting for covariates.
SNPlm(y, z, location, X, type1, type2, nbasis1, nbasis2, params1, params2, intercept = FALSE, Plot = FALSE)
SNPlm(y, z, location, X, type1, type2, nbasis1, nbasis2, params1, params2, intercept = FALSE, Plot = FALSE)
y |
a numeric vector specifying the response variables. |
z |
a matrix specifying 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 data, with the number of rows equal to the number of samples. |
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". |
type2 |
a character specifying the type of the basis functions that constitutes the genetic effect 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. |
nbasis2 |
an integer specifying the number of basis functions that constitutes the genetic effect 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; |
params2 |
in addition to rangeval1 (a vector of length 2 giving the lower and upper limits of the range of permissible values for the genetic effect function) and nbasis1, all bases have one or two parameters unique to that basis type or shared with one other;
|
intercept |
should intercept(s) be fitted (TRUE) or set to zero (default = FALSE). |
Plot |
should the estimated genetic effect function beta(t) be plotted (TRUE) or not (default = FALSE). |
An "SNPlm" object that contains the list of the following items.
alpha: estimated intercept value.
gamma: estimated coefficients of the scalar covariates.
b: estimated coefficients of the chosen basis functions for the genetic effect function beta(t).
betat: an "fd" object, representing the estimated genetic effect function beta(t).
residuals: the residuals, that is response minus fitted values.
fitted.values: the fitted mean values.
terms: the terms object used.
model: if requested (the default), the model frame used.
para: some relevant parameters of "SNPlm" model.
See Also as SNPgvf
.
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123) y <- simdata1$y z <- simdata1$z location <- simdata1$location X <- simdata1$X SNPlmres <- SNPlm(y, z, location, X, type1 = "Bspline", type2 = "Bspline", nbasis1 = 5, nbasis2 = 5, params1 = 4, params2 = 4, intercept = FALSE, Plot = TRUE) SNPlmres$alpha SNPlmres$gamma SNPlmres$b
library(FunctanSNP) n <- 300 m <- 30 simdata1 <- simData1(n, m, seed = 123) y <- simdata1$y z <- simdata1$z location <- simdata1$location X <- simdata1$X SNPlmres <- SNPlm(y, z, location, X, type1 = "Bspline", type2 = "Bspline", nbasis1 = 5, nbasis2 = 5, params1 = 4, params2 = 4, intercept = FALSE, Plot = TRUE) SNPlmres$alpha SNPlmres$gamma SNPlmres$b