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
)
list containing the following elements:
vector of the response
model matrix for the fixed effects
model matrix for the random effects, organized first by variable and then by group
number of non-zero fixed effects
values of the random effects for each variable for each level of the grouping factor
grouping factor
model matrix for just the non-zero fixed effects
integer specifying total number of samples to generate
integer specifying total number of covariates to generate (values randomly generated from the standard normal distribution)
integer specifying how may of the covariates should have non-zero fixed and random effects
number of studies/groups to have in the data
non-negative value specifying the standard deviation of the random effects covariance matrix (applied to the non-zero random effects)
character string specifying which family to generate data from. Family options include "binomial" (default), "poisson", and "gaussian".
optional value to specify correlation between covariates
in the model matrix. Default NULL
, only available within sim.data
.
integer to use for the setting of a random seed
integer of 0 or 1 indicating whether the observations should be equally distributed among the groups (0) or unequally distributed (1).
numeric vector of the fixed effects (including intercept)
non-negative integer specifying the number of covariates with a zero-valued fixed effect but a non-zero random effect.
non-negative value specifying the standard deviation of the
simulated covariates (drawn from a normal distribution with mean 0,
standard deviation sd_x
)
matrix specifying the factor loadings matrix for the random effects,
only used within sim.data.FA
.
Dimensions: number of columns is the number of random effects (including the intercept),
and number of rows is the number of latent common factors (r
).
The random effect covariance matrix is specified as Sigma = B x t(B) + diag(sd_raneff)
positive integer specifying number of latent common factors that describe the random effects,
only used within sim.data.FA
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
, and the
value of the first cut point must be 0.
vector of the log baseline hazard values for each time interval (which
correspond to the time intervals defined by the cut_points
argument) within
piecewise exponential data. Hazards are assumed to be constant within each time interval.
character specifying type of censoring to implement. Default "unif" specifies
uniform censoring from 0 to cens_max
. The option "exp" specifies exponential
censoring with rate exp_rate
numeric value used to characterize the range of the uniform censoring procedure
(from 0 to cens_max
)
numeric value used to characterize the exponential censoring rate (where rate
is defined as the rate used in rexp
)
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 simsurv
and the lambda notation in section "Weibull
distribution" in the simsurv vignette
https://cran.r-project.org/web/packages/simsurv/vignettes/simsurv_technical.html)
numeric value > 0 that gives the shape parameter for the Weibull distribution
(for description of Weibull shape paraemeter,
see "gammas" argument in simsurv
and the gamma notation in section "Weibull
distribution" in the simsurv vignette
https://cran.r-project.org/web/packages/simsurv/vignettes/simsurv_technical.html)