View source: R/sim_generation.R
sim.data | R Documentation |
glmmPen
packageSimulates data to use for testing the glmmPen
package.
sim.data
simulates data for glmmPen
,
sim.data.FA
simulates data for glmmPen_FA
,
sim.data.piecewise.exp
simulates survival data for phmmPen
and phmmPen_FA
,
and sim.data.weibull
simulates alternative survival data for phmmPen
and phmmPen_FA
.
Possible parameters to specify includes number of total covariates,
number of non-zero fixed and random effects, and the magnitude
of the random effect covariance values.
sim.data(
n,
ptot,
pnonzero,
nstudies,
sd_raneff = 1,
family = "binomial",
corr = NULL,
seed,
imbalance = 0,
beta = NULL,
pnonzerovar = 0,
sd_x = 1
)
sim.data.FA(
n,
ptot,
pnonzero,
nstudies,
sd_raneff = 0,
family = "binomial",
B = NULL,
r = 2,
corr = NULL,
seed,
imbalance = 0,
beta = NULL,
pnonzerovar = 0,
sd_x = 1
)
sim.data.piecewise.exp(
n,
ptot,
pnonzero,
nstudies,
sd_raneff = 0,
B = NULL,
r = 2,
cut_points = c(0, 0.5, 1, 1.5, 2),
lhaz_vals = c(-1.5, 1, 2.7, 3.7, 6.8),
cens_type = c("unif", "exp"),
cens_max = 5,
exp_rate = 0.15,
seed,
imbalance = 0,
beta = NULL,
pnonzerovar = 0,
sd_x = 1
)
sim.data.weibull(
n,
ptot,
pnonzero,
nstudies,
sd_raneff = 0,
B = NULL,
r = 2,
lhaz_base = 1,
alpha_PH = 5,
exp_rate = 0.15,
cens_type = c("unif", "exp"),
cens_max = 5,
seed,
imbalance = 0,
beta = NULL,
pnonzerovar = 0,
sd_x = 1
)
n |
integer specifying total number of samples to generate |
ptot |
integer specifying total number of covariates to generate (values randomly generated from the standard normal distribution) |
pnonzero |
integer specifying how may of the covariates should have non-zero fixed and random effects |
nstudies |
number of studies/groups to have in the data |
sd_raneff |
non-negative value specifying the standard deviation of the random effects covariance matrix (applied to the non-zero random effects) |
family |
character string specifying which family to generate data from. Family options include "binomial" (default), "poisson", and "gaussian". |
corr |
optional value to specify correlation between covariates
in the model matrix. Default |
seed |
integer to use for the setting of a random seed |
imbalance |
integer of 0 or 1 indicating whether the observations should be equally distributed among the groups (0) or unequally distributed (1). |
beta |
numeric vector of the fixed effects (including intercept) |
pnonzerovar |
non-negative integer specifying the number of covariates with a zero-valued fixed effect but a non-zero random effect. |
sd_x |
non-negative value specifying the standard deviation of the
simulated covariates (drawn from a normal distribution with mean 0,
standard deviation |
B |
matrix specifying the factor loadings matrix for the random effects,
only used within |
r |
positive integer specifying number of latent common factors that describe the random effects,
only used within |
cut_points |
vector of cut points to use for the time intervals when simulating piecewise
exponential data. Length of cut points must equal length of |
lhaz_vals |
vector of the log baseline hazard values for each time interval (which
correspond to the time intervals defined by the |
cens_type |
character specifying type of censoring to implement. Default "unif" specifies
uniform censoring from 0 to |
cens_max |
numeric value used to characterize the range of the uniform censoring procedure
(from 0 to |
exp_rate |
numeric value used to characterize the exponential censoring rate (where rate
is defined as the rate used in |
lhaz_base |
numeric value that gives the log of the scale parameter for the Weibull distribution
(for description of Weibull scale parameter without log transformation,
see "lambdas" argument in |
alpha_PH |
numeric value > 0 that gives the shape parameter for the Weibull distribution
(for description of Weibull shape paraemeter,
see "gammas" argument in |
list containing the following elements:
y |
vector of the response |
X |
model matrix for the fixed effects |
Z |
model matrix for the random effects, organized first by variable and then by group |
pnonzero |
number of non-zero fixed effects |
z1 |
values of the random effects for each variable for each level of the grouping factor |
group |
grouping factor |
X0 |
model matrix for just the non-zero fixed effects |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.