View source: R/f_numeric_glm.R
| f_numeric_glm | R Documentation |
Fits a Gaussian GLM model y ~ x with the numeric response y and the numeric, character, or factor predictor x using stats::glm() and returns the R-squared of the observations against the predictions (see score_r2()).
Supports cross-validation via the arguments arguments cv_training_fraction (numeric between 0 and 1) and cv_iterations (integer between 1 and n) introduced via ellipsis (...). See preference_order() for further details.
f_numeric_glm(df, ...)
df |
(required, dataframe) with columns:
|
... |
(optional) Accepts the arguments |
numeric or numeric vector: R-squared
Other preference_order_functions:
f_binomial_gam(),
f_binomial_glm(),
f_binomial_rf(),
f_categorical_rf(),
f_count_gam(),
f_count_glm(),
f_count_rf(),
f_numeric_gam(),
f_numeric_rf(),
preference_order()
data(vi_smol)
df <- data.frame(
y = vi_smol[["vi_numeric"]],
x = vi_smol[["swi_max"]]
)
#no cross-validation
f_numeric_glm(df = df)
#cross-validation
f_numeric_glm(
df = df,
cv_training_fraction = 0.5,
cv_iterations = 10
)
#categorical predictor
df <- data.frame(
y = vi_smol[["vi_numeric"]],
x = vi_smol[["koppen_zone"]]
)
f_numeric_glm(df = df)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.