Generates a synthetic data set composed of one dependent variable, a
number of independent variables drawn from Uniform(0, 1), and
optionally the X and Y coordinates of a regular nrows x
ncols grid. Useful for examples, unit testing and small
simulation studies.
random.test.data(nrows = 10, ncols = 10, vars.no = 3,
dep.var.dis = c("normal", "poisson"),
xycoords = TRUE)A data frame with nrows * ncols rows containing one column
dep, vars.no - 1 columns named X1, X2, ... and,
when xycoords = TRUE, two extra columns X and Y.
integer; number of rows of the regular grid. Default
10.
integer; number of columns of the regular grid. Default
10.
integer; total number of model variables (1 dependent
plus vars.no - 1 independent). Must be at least 2.
distribution of the dependent variable. One of
"normal" (default, drawn from rnorm()) or
"poisson" (drawn from rpois() with lambda = 7).
logical; if TRUE (default) two columns X
and Y containing the grid coordinates are appended.
Stamatis Kalogirou stamatis.science@gmail.com
The function is mostly intended to provide reproducible toy data for
the package examples. The independent variables are named
X1, X2, ..., X(vars.no - 1).
For reproducible results call set.seed() before
random.test.data().
set.seed(1)
RDF <- random.test.data(12, 12, 3)
head(RDF)
Run the code above in your browser using DataLab