random_terms {LSTbook} | R Documentation |
Create columns with random numbers for modeling
Description
For demonstration purposes, add the specified number of
random columns to a model matrix. This is intended to be used
in modeling functions, e.g. model_train()
, lm()
, and so on
to explore the extent to which random columns "explain" the
response variable.
Usage
random_terms(df = 1, rdist = rnorm, args = list(), n, seed = NULL)
Arguments
df |
How many columns to add |
rdist |
Function to generate each column's numbers (default: |
args |
A list holding the parameters (if any) to be used for the |
n |
OPTIONALLY, dictate the number of rows in the output |
seed |
Integer seed for the random-number generator |
Details
random_terms()
will try to guess a suitable value for n
based on
the calling function.
Examples
mtcars |> model_train(mpg ~ wt + random_terms(4)) |> conf_interval()
mtcars |> model_train(mpg ~ wt + random_terms(4)) |> anova_summary()
head(mtcars) |> select(wt, mpg) |> mutate(r = random_terms(3))
[Package LSTbook version 0.6 Index]