svd_olsgasp: Singular Value Decomposition of X and Y

View source: R/svd_olsgasp.R

svd_olsgaspR Documentation

Singular Value Decomposition of X and Y

Description

Make the SVD of the covariates matrix X and the incomplete matrix Y

Usage

svd_olsgasp(Y_obs, sites, X, tol_eig = 0)

Arguments

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

Value

a list with all the object necessary to the estimation and prediction.

Author(s)

Melina Ribaud

References

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

Examples


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)

melinaR/olsgasp documentation built on March 11, 2023, 12:10 a.m.