simulate | R Documentation |
Xy()
A function which simulates linear and nonlinear X and a corresponding target. The composition of the target is highly customizable. Furthermore, the polynomial degree as well as the functional shape of nonlinearity can be specified by the user. Additionally coviarance structure of the X can either be sampled by the function or specifically determined by the user.
simulate(
object,
n = 1000,
r_squared = 0.8,
cor_interval = c(-0.5, 0.5),
cor_matrix = NULL,
...
)
object |
an object of class |
n |
an integer specifying the desired number of obervations. |
r_squared |
a numeric value between 0 and 1. |
cor_interval |
a vector of length 2, which provides the correlation sample interval for the correlation matrix. |
cor_matrix |
a (positive semidefinite) correlation matrix.
This matrix inherits the desired correlation structure of
the simulated effects. Defaults to |
... |
additional parameters |
The simulation uses a copula backend and can simulate effects from various distributions.
r_squared
: The simulation adjusts the noise of the target generating
process according to the user specified input of the R^2.
Hence, if the user chooses to set a high R^2 then the noise
will have little to no effect on the target generating
process. Choosing lower R^2 yields to a stronger noise.
Thus, when fitting an ML model, the r_squared
is the
upper bound of achievable adjusted r_squared.
An object of class xy_sim
, which contains meta information about the
simulation. The user can manipulate this object with methods from
the class xy_sim
, e.g. importance()
.
Andre Bleier (andre.bleier@statworx.com)
# create a recipe
recipe <- Xy() %>%
add_linear(p = 5, family = xy_weibull())
# cook the recipe
recipe %>% simulate(n = 10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.