ancova.random.data {MBESS} | R Documentation |
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)
mu.y |
a vector of the population group means of the response variable |
mu.x |
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) |
sigma.y |
the population stadnard deviation of the response variable |
sigma.x |
the population stadnard deviation of the covariate |
rho |
the population correlation coefficient between the response and the covariate |
J |
the number of groups |
n |
the number of sample size per group |
randomized |
a logical statement of whether randomized design is used |
This function uses multivariate normal distribution to generate the random data; the covariate is consiered
as random in the model. This function uses mvrnorm
in the MASS
package as an internal function, and
thus it requires the MASS
package be installed first.
This function assumes homogeneous covariance matrix among groups, in both the randomized design and non-randomized design contexts.
This function returns an n
by J*2
matrix, where n
and J
are what are defined
in the argument. The first J
columns of the matrix contains the random data for the response, and
the second J
columns of the matrix contains the random data for the covariate.
Keke Lai <Lai.15@ND.edu>
mvrnorm
in the MASS
package
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)