A function provides simulated outcomes as well as covariates under the framework of GLM. All covariates (except for intercept) are normally distributed.
Arguments
- beta
The underlying true coefficient for each covariates in the model (including the intercept).
- samplesize
The sample size.
- rho
The correlation coefficient among covariates.
- dist
A specified distribution. It can be "gaussian", "poisson",and "binomial".
- sd.gaussian
The standard deviation for the outcome from Gaussian distribution.
- ov
The dispersion parameter for the outcome from Negative Binomial distribution.
Value
x: a matrix containing continuous covariates. The first column should contain all ones corresponding to the intercept.
y: a vector containing outcomes.
Examples
beta<-c(0.5,0.5,0.5,0)
samplesize<-100
data<-glm.generator(beta=beta,samplesize=samplesize,rho=0.5,dist="poisson")