sigcovfuncs_cppforR: Covariance and Sigma Functions In SAMM: Some Algorithms for Mixed Models

Description

The "kernel" functions end with "cov_cppforR" and sigma functions end with "Sig_cppforR". Check table below and the examples for details and usage. Documentation for some of these functions is missing. Let K be a given covariance matrix, D be a given Euclidean distance matrix, let q be the dimension of desired sigma or covariance matrices.

Arguments

 params a numeric vector for the parameters (a mapping of the original parameters) data a numeric matrix (see examples and details)

Details

 function name function ref params data formula IdentSig_cppforR Ident 1 matrix(q,1,1) A=σ I_q ar1hetcov_cppforR ar1het q matrix(q,1,1) A_{ij}=σ_iσ_jρ^{|i-j|}, σ_1=1 arma11cov_cppforR arma11 2 matrix(q,1,1) A_{ij}=(λρ^{|i-j|-1}* 1(i\neq j)+1(i=j)) FA1hetSig_cppforR FA1het 2q-2 matrix(q,1,1) f_if_j+σ_{ii}1(i=j) f_1=1, σ_1=1 FA1homSig_cppforR FA1hom q matrix(q,1,1) f_if_j+σ 1(i=j) f_1=1 compsymmcov_cppforR compsymm 1 matrix(q,1,1) A_{ij}=ρ, i\neq j; A_{ij}=1, i=j compsymmhetSig_cppforR compsymmhet q+1 matrix(q,1,1) A_{ij}=σ_iσ_jρ, i\neq j A_{ij}=σ_iσ_j, i= j compsymmhetcov_cppforR compsymmhet q matrix(q,1,1) A_{ij}=σ_iσ_jρ, i\neq j A_{ij}=σ_iσ_j, i= j σ_1=1 compsymmhomSig_cppforR compsymmhom 2 matrix(q,1,1) A_{ij}=σρ, i\neq j; A_{ij}=σ, i=j diagSig_cppforR diag q matrix(q,1,1) diag(σ_1,..,σ_q) diagcov_cppforR Diag q-1 matrix(q,1,1) diag(1,σ_2,..,σ_q) expcov_cppforR exp 1 M exp(-σ*d_{ij}) M defines D lincombcov_cppforR lincomb k (K_1;…; K_k) ∑^k_{j=1}w_jK_j rbfcov_cppforR rbf 1 M exp(-σ*d^2_{ij}) M defines D ar1cov_cppforR ar1 1 matrix(nrow, 1,1) A_{ij}=ρ^{|i-j|} relmatcov_cppforR RelMat 1 M Genetic Similarity+ M is coded as -1, 0, 1 σ I unstrcov_cppforR unstr \frac{q(q+1)}{2}-1 matrix(q,1,1) A_{ij}=σ_iσ_jρ_{ij} σ_1=1, ρ_{ii}=1 ConstMatcov_cppforR Const 0 K A=K expdistcov_cppforR expdist 1 D exp(-σ d_{ij}) rbfdistcov_cppforR rbfdist 1 D exp(-σ d^2_{ij}) splincov_cppforR splin 1 D 1-ρ d_{ij}, ρ d_{ij}≤q 1 0, ρ d_{ij}> 1 sppowcov_cppforR sppow 1 D ρ^{d_{ij}}

Value

A kernel or sigma matrix.

Deniz Akdemir

Examples

  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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 ## Not run: library(SAMM) n=100 nsample=80 rhotrans=5 ar1cov_cppforR(c(rhotrans),matrix(5)) rho=(2/pi)*atan(rhotrans) rho tan((pi/2)*(rho)) M1<-matrix(rbinom(n*300, 2, .2)-1, nrow=n) K1<-relmatcov_cppforR(c(.01), M1) M2<-matrix(rbinom(n*300, 2, .2)-1, nrow=n) K2<-relmatcov_cppforR(c(0.03), M2) W=(diag(5)[sample(1:5,n, replace=TRUE),]) covY<-3*K1+5*K2+10*(W%*%ar1cov_cppforR(c(rhotrans),matrix(5))%*%t(W)) K1[1:5,1:5] dim(W) dim(ar1cov_cppforR(c(6),matrix(5))) Y<-10+crossprod(chol(covY),rnorm(n)) #training set Trainset<-sample(1:n,nsample) ytrain=Y[Trainset] Xtrain=matrix(rep(1, n)[Trainset], ncol=1) Ztrain=diag(n)[Trainset,] Wtrain=W[Trainset,] samout<-SAMM(Y=matrix(ytrain,ncol=1),X=Xtrain, Zlist=list(Ztrain, Ztrain), Klist=list(K1,K2), lambda=0, W=Wtrain,R=list("ar1",c(0),matrix(5,1,1)), Siglist=list("","",""), corfunc=c(F,F,T), corfuncfixed=c(F,F,F), sigfunc=c(F,F,F),mmalg="dermm_reml2", tolparconv=1e-10, tolparinv=1e-10,maxiter=1000,geterrors=F) samout$corfuncparamslist[[3]] rhohat=(2/pi)*atan(samout$corfuncparamslist[[3]]) rhohat ar1cov_cppforR(c(samout\$corfuncparamslist[[3]]),matrix(5,1,1)) ## End(Not run) 

SAMM documentation built on May 2, 2019, 2:08 a.m.