| Type: | Package | 
| Title: | Penalized Variance Components Analysis | 
| Version: | 1.9 | 
| Date: | 2022-01-02 | 
| Description: | Method to perform penalized variance component analysis. | 
| License: | GPL (≥ 3) | 
| Suggests: | rmarkdown, testthat | 
| Depends: | R (≥ 4.0.0), methods | 
| Imports: | knitr, Rcpp (≥ 1.0.0), RcppArmadillo (≥ 0.8.0) | 
| LinkingTo: | Rcpp, RcppArmadillo | 
| NeedsCompilation: | yes | 
| RoxygenNote: | 7.1.2 | 
| VignetteBuilder: | knitr | 
| URL: | https://cran.r-project.org/package=vcpen | 
| Packaged: | 2022-01-03 15:18:57 UTC; sinnwell | 
| Author: | Jason Sinnwell | 
| Maintainer: | Jason Sinnwell <sinnwell.jason@mayo.edu> | 
| Repository: | CRAN | 
| Date/Publication: | 2022-01-03 16:40:02 UTC | 
Variance Component Linear Kernel Matrix
Description
Variance component Linear kernel matrix from genotype dosage
Usage
kernel_linear(dose, method = "linear")
Arguments
| dose | data.frame or matrix with | 
| method | type of kernel; currently only linear kernel implemented | 
Value
square symmetric kernel matrix for subject similarity by genotype dosage
Author(s)
JP Sinnwell, DJ Schaid
See Also
Examples
data(vcexample)
Kern1 <- kernel_linear(dose[,which(doseinfo[,1]==1)], method="linear")
Kern1[1:5,1:5]
MINQUE estimation of variance components
Description
Estimate variance components by MINQUE method, allowing multiple iterations
Usage
minque(y, X, Kerns, n.iter = 1, eps = 0.001)
Arguments
| y | Numeric vector of traits. Only continuous trait currently allowed. | 
| X | Matrix of covariates (columns) for subjects (rows), matching subjects in the trait (y) vector. | 
| Kerns | List of kernel matrices: a kernel matrix for each variance compenent. The last kernel matrix in the list (an identity matrix) is for the residual variance component. | 
| n.iter | Number of minque iterations | 
| eps | Default small positive value for non-positive vc estimates within iterations. | 
Value
List with estimates of variance components (vc), covariate regression coefficients (beta), and residuals of model fit.
Author(s)
JP Sinnwell, DJ Schaid
Examples
data(vcexample)
nvc <- 1+length(unique(doseinfo[,2]))
id <- 1:nrow(dose)
## vcs for genetic kernel matrices
Kerns <- vector("list", length=nvc)
for(i in 1:(nvc-1)){
  Kerns[[i]] <- kernel_linear(dose[,grep(i, doseinfo[,2])])
  rownames(Kerns[[i]]) <- id
  colnames(Kerns[[i]]) <- id
}
## vc for residual variance
Kerns[[nvc]] <- diag(nrow(dose))
rownames(Kerns[[nvc]]) <- id
colnames(Kerns[[nvc]]) <- id
prefit  <- minque(response, covmat, Kerns, n.iter=2)
prefit[1]
prefit[2]
fit <- vcpen(response, covmat, Kerns, vc_init = prefit$vc)
Example data for Penalized Variance Component method
Description
Datasets for an example run of vcpen with 4 variance components calculated as kernel matrices from genotype dosage (dose) on 100 subjects with two covariates (covmat), and a continuous response.
Format
The example contains three data.frames and a response vector for 100 subjects at 70 SNPs accross 4 variance components:
- covmat
- two arbitrary covariates (columns) for 100 subjects (rows) 
- dose
- genotype dosage at 70 SNPs (columns) and 100 subjects (rows) 
- doseinfo
- 2-column matrix with indices for grouping SNPs into variance components (for Kernel Matrix) 
- response
- continuous response vector for 100 subjects 
Examples
data(vcexample)
dim(dose)
dim(doseinfo)
dim(covmat)
length(response)
Penalized Variance Components
Description
Penalized Variance Component analysis
Usage
vcpen(
  y,
  X,
  Kerns,
  frac1 = 0.8,
  lambda_factor = NULL,
  lambda_grid = NULL,
  maxiter = 1000,
  vc_init = NULL,
  print_iter = FALSE
)
## S3 method for class 'vcpen'
summary(object, ..., digits = 4)
Arguments
| y | Numeric vector of traits. Only continuous trait currently allowed. | 
| X | Matrix of covariates (columns) for subjects (rows), matching subjects in the trait (y) vector. | 
| Kerns | List of kernel matrices: a kernel matrix for each variance compenent. The last kernel matrix in the list (an identity matrix) is for the residual variance component. | 
| frac1 | Fraction of penalty imposed on L1 penalty, between 0 and 1 (0 for only L2; 1 for only L1 penalty). | 
| lambda_factor | Weight for each vc (values between 0 and 1) for how much it should be penalized: 0 means no penalty. Default value of NULL implies weight of 1 for all vc's. | 
| lambda_grid | Vector of lambda penalties for fitting the penalized model. Best to order values from largest to smallest so parameter estimates from a large penalty can be used as initial values for the next smaller penalty. Default value of NULL implies initial values of seq(from=.10, to=0, by=-0.01). | 
| maxiter | Maximum number of iterations allowed during penalized fitting. | 
| vc_init | Numeric vector of initial values for variance components. Default value of NULL implies initial values determined by 2 iterations of minque estimation. | 
| print_iter | Logical: if TRUE, print the iteration results (mainly for refined checks) | 
| object | Fitted vcpen object (used in summary method) | 
| ... | Optional arguments for summary method | 
| digits | Signficant digits for summary method | 
Value
object with S3 class vcpen
Author(s)
JP Sinnwell, DJ Schaid
Examples
data(vcexample)
nvc <- 1+length(unique(doseinfo[,2]))
id <- 1:nrow(dose)
## vcs for genetic kernel matrices
Kerns <- vector("list", length=nvc)
for(i in 1:(nvc-1)){
  Kerns[[i]] <- kernel_linear(dose[,grep(i, doseinfo[,2])])
  rownames(Kerns[[i]]) <- id
  colnames(Kerns[[i]]) <- id
}
## vc for residual variance
Kerns[[nvc]] <- diag(nrow(dose))
rownames(Kerns[[nvc]]) <- id
colnames(Kerns[[nvc]]) <- id
fit  <- vcpen(response, covmat, Kerns, frac1 = .6)
summary(fit)