f_r2_counts {collinear}R Documentation

Association Between a Count Response and a Continuous Predictor

Description

These functions take a data frame with a integer counts response "y", and a continuous predictor "x", fit a univariate model, and return the R-squared of observations versus predictions:

Usage

f_r2_glm_poisson(df)

f_r2_glm_poisson_poly2(df)

f_r2_gam_poisson(df)

Arguments

df

(required, data frame) with columns:

  • "x": (numeric) continuous predictor.

  • "y" (integer) counts response.

See Also

Other preference_order_functions: f_auc, f_r2, f_v(), f_v_rf_categorical()

Other preference_order_functions: f_auc, f_r2, f_v(), f_v_rf_categorical()

Other preference_order_functions: f_auc, f_r2, f_v(), f_v_rf_categorical()

Other preference_order_functions: f_auc, f_r2, f_v(), f_v_rf_categorical()

Examples


#load example data
data(vi)

#reduce size to speed-up example
vi <- vi[1:1000, ]

#integer counts response and continuous predictor
#to data frame without NAs
df <- data.frame(
  y = vi[["vi_counts"]],
  x = vi[["swi_max"]]
) |>
  na.omit()

#GLM model with Poisson family
f_r2_glm_poisson(df = df)

#GLM model with second degree polynomials and Poisson family
f_r2_glm_poisson_poly2(df = df)

#GAM model with Poisson family
f_r2_gam_poisson(df = df)

[Package collinear version 2.0.0 Index]