Description Usage Arguments Value Examples
This function generates a dataset which contains a matrix corresponding to the genetic information and a vector of observations. This dataset corresponds to the type of arguments which is expected in the funtion HiLMM.
1 |
n |
size of the vector of observations that the user wants to generate. |
N |
number of columns of the genetic information matrix that the user wants to generate. |
eta_star |
value of the heritability. |
q |
proportion of non zero components in the random effects associated to the genetic information matrix. |
Y |
vector of observations of size n |
W |
Matrix of size n x N which contains entries with 0,1 and 2 |
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 | library(HiLMM)
data_sim=data_simu(100,1000,0.5,0.5)
Y=data_sim$Y
W=data_sim$W
## The function is currently defined as
function (n, N, eta_star, q)
{
sigma_u = 1
P = runif(N, 0.1, 0.5)
W = matrix(0, n, N)
for (j in 1:N) {
W[, j] = rbinom(n, 2, P[j])
}
nb_comp_non_zero = q * N
sigma_e = sqrt(q * N * sigma_u^2 * (1 - eta_star)/eta_star)
b = sample(1:N, nb_comp_non_zero)
a1 = sort(b)
u = rnorm(nb_comp_non_zero, 0, sigma_u)
e = rnorm(n, 0, sigma_e)
U = matrix(0, N)
U[a1] = u
Z = scale(W, center = TRUE, scale = TRUE)
Y = Z %*% U + e
list(Z = Z, Y = Y)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.