simulation | R Documentation |
These functions simulate predictor variables and response outcomes, and summarize the analysis of simulated data.
sim.x(n, m, group = NULL, corr = 0.6, v = rep(1, m), p = 0.5, genotype = NULL)
sim.eta(x, mu = 0, coefs = NULL, herit = 0.1, sigma = 1, p.neg = 0.5)
sim.y(x, mu = 0, coefs = NULL, herit = 0.1, p.neg = 0.5, sigma = 1, quantiles = 0.5, , theta = 3, df = 3)
sim.out(coefs.p, coefs.est, alpha = c(0.05, 0.01))
n |
number of simulated data points (individuals). |
m |
number of simulated continuous variables or discrete genetic markers. |
group |
a numeric vector, or an integer, or a list indicating the groups of variables.
If |
corr |
correlation between variables. If |
v |
variances of simulated variables. |
p |
minor allelic frequencies for simulated markers. |
genotype |
transform some continuous variables to three-level genotypes. |
x |
a design matrix of simulated variables. |
mu |
intercept. |
coefs |
coefficients of variables. If |
herit |
heritabilities of variables (proportions of variance explained by variables), which is used to calculate the coefficients.
If |
p.neg |
proportion of negative coefficients. |
sigma |
residual standard deviation for normal or t response. |
quantiles |
quantiles for generating binary or ordinal responses. |
theta |
shape parameter for negative binomial or beta responses. |
df |
degree of freedom of t response. |
coefs.p |
a matrix of p-values of coefficients. The rows and columns are coefficients and simulations, respectively. |
coefs.est |
a matrix of coefficient estimates. The rows and columns are coefficients and simulations, respectively. |
alpha |
significance levels for calculating power. |
The function sim.x()
simulates m
variables or genotypes of m
markers for n
individuals.
The function sim.y()
calculates coefficient values if coefs = NULL
and the linear predictors eta = mu + x * coefs
, simulates n
normal phenotypes with mean eta
and variance sigma^2
, categorizes the normal phenotypes to binary or ordinal phenotypes,
simulates survival outcome, count outcomes from Poisson or negative binomial, Student-t outcomes, and beta outcome.
The function sim.out()
calculates statistical powers and estimates for all variables.
sim.x()
returns a n x m
data frame of continuous values or genotypes 0, 1, 2.
sim.y()
returns a list of normal outcome y.normal
,
binary or ordinal outcome y.ordinal
, poisson outcome y.poisson
, negative binomial outcome y.nb
, t outcome y.t
, beta outcome y.beta
, survival outcome y.surv
,
linear predictor values eta
, coefficients coefs
,
residual standard deviation sigma
and heritabilities herit
.
sim.out()
returns a list of power and estimate for each variable.
Nengjun Yi, nyi@uab.edu
See examples in the functions bglm
, bpolr
, bcoxph
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.