svd_olsgasp | R Documentation |
Make the SVD of the covariates matrix X and the incomplete matrix Y
svd_olsgasp(Y_obs, sites, X, tol_eig = 0)
Y_obs |
a incomplete matrix, data frame or data table to impute. The missing values are NA. |
sites |
a numeric vector of size equal to the number of col of Y_obs with the sites location. |
X |
a matrix, data frame or data table with the covariables same number of row as Y_obs. |
tol_eig |
the threshold for the eigen values of the wo SVD |
a list with all the object necessary to the estimation and prediction.
Melina Ribaud
Melina Ribaud, Aurélie Labbe and Karim Oualkacha. Imputation in genetic methylation studies: A linear model of coregionalization (LMC) with informative covariates. 2022. hal-00000000
library(FastGP) N = 100 K = 10 D = 2 sites = sort(runif(N)) beta = c(runif(D,2,5),runif(K-D,10,1000)) nugget = c(rep(0,D),runif(K-D,0.001,0.05)) A = matrix(runif(K*(K-D),0,0.1),nrow = K, ncol = K-D ) X = matrix(runif(D*K),ncol = D, nrow= K) Hx = matrix(solve(t(X)%*%X,t(X)),nrow = length(X)/K) A = A-X%*%Hx%*%A A = cbind(X,A) V = matrix(NA, nrow = K, ncol = N) R00 = abs(outer(sites, sites, '-')) for (d in 1:K) { R = matern_5_2_kernel(R00, beta = beta[d]) R_tilde = R + nugget[d] * diag(N) V[d, ] = rcpp_rmvnorm_stable(1, R, rep(0, N)) } Y_obs = A %*% V obj_olsgasp = svd_olsgasp(Y_obs,sites,X,tol_eig = 1e-6)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.