View source: R/supporting_functions.R
glm.generator | R Documentation |
A function provides simulated outcomes as well as covariates under the framework of GLM. All covariates (except for intercept) are normally distributed.
glm.generator(beta, samplesize, rho = 0, dist, sd.gaussian = NULL, ov = NULL)
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. |
x: a matrix containing continuous covariates. The first column should contain all ones corresponding to the intercept.
y: a vector containing outcomes.
beta<-c(0.5,0.5,0.5,0) samplesize<-100 data<-glm.generator(beta=beta,samplesize=samplesize,rho=0.5,dist="poisson")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.