random_terms | R Documentation |
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.
random_terms(df = 1, rdist = rnorm, args = list(), n, seed = NULL)
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 |
random_terms()
will try to guess a suitable value for n
based on
the calling function.
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))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.