xy_sim: Methods of the class 'xy_sim'

xy_simR Documentation

Methods of the class xy_sim

Description

Methods of the class xy_sim

Usage

## S3 method for class 'xy_sim'
print(x, ...)

## S3 method for class 'xy_sim'
coef(object, ...)

## S3 method for class 'xy_sim'
plot(x, ...)

## S3 method for class 'xy_sim'
transform(`_data`, ...)

## S3 method for class 'xy_sim'
formula(x, ...)

Arguments

x

an object of class xy_sim

...

additional parameters

object

an object of class xy_sim

_data

an object of class xy_sim

Details

With the help of these methods you can further manipulate a cooked simulation.

  • print.xy_sim(): Gives you an overview of the simulation

  • coef.xy_sim(): Extracts the beta coeffecients of the simulation from y = X\beta + e

  • plot.xy_sim(): Will plot the true effects of the simulation, e.g. X vs y

  • transform.xy_sim(): Will return the adjusted simulated data, i.e. it will apply all nonlinear transformations to the raw simulated effects and multiply the X by its beta coefficient. This function is mostly used internally, however, exposed to the user as it could be needed in edge cases.

  • formula.xy_sim(): Will return a formula object which can be forwarded to the machine learning algorithm. Note: Uninformative features are added as well.

Examples

# create a simulation
linear_sim <- Xy() %>%
  add_linear(p = 5) %>%
  simulate(n = 100)

# print the simulation
simulation_info <- linear_sim %>% print()

# get the coefficients of the features
simulation_coefs <- linear_sim %>% coef()

# plot the underlying true effect of X
simulation_plot <- linear_sim %>% plot()

# transform the data of the simulation such that the features are transformed
# e.g. nonlinear features are scaled by their functions.
transformed_simulation <- linear_sim %>% transform()

# fetch the formula
eqn <- linear_sim %>% formula()

andrebleier/Xy documentation built on March 29, 2023, 12:41 p.m.