Simulation.default {lmviz} | R Documentation |
Simulates a sample
Description
Simulates an (x,y) sample (suitable for estimating a lm) which can be either non linear/heteroscedastic/non normal or in line with standard lm assumptions
Usage
Simulation.default(model.to.sim)
Arguments
model.to.sim |
an integer between 1 and 4 where 1=non linearity; 2=heteroscedasticity; 3=non normality; 4=no violation |
Details
The sample size is simulated between 10 and 1000 according to a uniform distribution. The explanatory variable is simulated as uniform, Gaussian, chi.square, t or a mixture of normal distributions. If non linearity or heteroscedasticity is chosen a random regression function or variance function is defined, if non normality is chosen the (always additive) error is simulated from a chi.square, t, Beta or truncated normal.#'
Value
A list of objects (of which the first two are essential, the following are needed to display the correct solution in the shiny app)
x , y |
the sample |
my |
the true mean of Y |
sderr |
the true standard deviation of errors |
errore |
the errors |
xperdens , ferrore |
coordinates of points of the true density of errors |
Author(s)
Francesco Pauli, francesco.pauli@deams.units.it
See Also
ComputerDecision.default
, checksim
Examples
Simulation.default(1)
Simulation.default(sample(1:4,1))