Generate random data for a simple (one-response-one-covariate) ANCOVA model considering the covariate as random. Data can be generated in the contexts of both randomized design (same population covariate mean across groups) and non-randomized design (different population covariate means across groups).
ancova.random.data(mu.y, mu.x, sigma.y, sigma.x, rho, J, n, randomized = TRUE)
a vector of the population group means of the response variable
the population mean of the covariate (in the randomized design context), or a vector of the population group means of the covariate (in the non-randomized design context)
the population standard deviation of the response (outcome) variable
the population standard deviation of the covariate
the population correlation coefficient between the response and the covariate
the number of groups
the number of sample size per group
a logical statement of whether randomized design is used
This function uses a multivariate normal distribution to generate the random data; the covariate is considered
as a random variable in the model. This function uses
mvrnorm in the
MASS package in an internal function, and
thus it requires the
MASS package be installed.
This function assumes homogeneous covariance matrix among groups, in both the randomized design and non-randomized design contexts.
This function returns an
J2 matrix, where
J are as defined
in the argument. The first
J columns of the matrix contains the random data for the response, and
J columns of the matrix contains the random data for the covariate.
Keke Lai (University of California-Merced) and Ken Kelley (University of Notre Dame) <email@example.com>
mvrnorm in the
random.data <- ancova.random.data(mu.y=c(3,5), mu.x=10, sigma.y=1,
sigma.x=2, rho=.8, J=2, n=20)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.