rvg4yx: Random variates generator for simulation studies

Description Usage Arguments Details Value Note Author(s) See Also Examples

View source: R/rvg4yx.R

Description

rvg4yx generates random variates of a response variable under the given conditions of mean and variance-covariance structure of matrices of predictors and their coefficients.

Usage

1
2
3
  rvg4yx(N, pars, xreg = FALSE, ztrunc = FALSE,
    kind = c("mvnorm", "mvbin", "norbin", "usrdef", "sknorm", "multinom", "poisson", "nbinom", "norbin", "gambin", "gambeta"),
    seed = NULL, shape = Inf, center.X = FALSE, ...)

Arguments

N

a number of random variates

pars

a vector of regression parameters

ztrunc

FALSE by default

xreg

FALSE by default

seed

NULL a random seed

shape

a shape parameter of gamma distribution

...

other arguments

kind

types of random variates

center.X

Are predictors centered at their means?

Details

The mean parameter of a response variable is a function of linear predictor by a link function in the context of generalized linear models.

Log and logit links are supported.

Default to Xstr is an independent multivariate normal distribution with mean Xmean, correlation R, and standard deviation Xsd.

Value

a list with components

n

the number of observations which are actually realized

y

the n-by-1 vector of response generated

X

the n-by-p-1 matrix (an intercept is excluded)

yX

the n-by-p data frame which includes y and X

Note

Default to a matrix decomposition method is eigen. Other options are chol and svd.

Currently, the link logit is not supported.

Author(s)

Chel Hee Lee <gnustats@gmail.com>

See Also

rmvnorm, rmvbin, rsn, rmsn

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
## Not run: 
tmp <- rvg4yx(N=5e2, pars=c(0.5, -0.5), ztrunc=TRUE, xreg=TRUE, kind="mvnorm", mean=xm, sigma=xsigma, center.X=TRUE)
dat <- tmp$yX
table(dat$y)

## End(Not run)
# y <- dat$y
# print(c(mean(y), dat$cm1))
# print(c(var(y), dat$cm2, dat$cm22))
# print(c(skewness(y), dat$g1))

# dat1 <- rvg4yx(N=1e1, xreg=FALSE, pars=2, ztrunc=TRUE, shape=4)
# y1 <- dat1$y
# print(c(mean(y1), dat1$cm1))
# print(c(var(y1), dat1$cm2, dat1$cm22, dat1$cm23))
# print(c(skewness(y1), dat1$g1))

ipeglim documentation built on May 2, 2019, 4:31 p.m.