data(vi)
#reduce size to speed-up example
vi <- vi[1:1000, ]
#numeric response and predictor
#to data frame without NAs
df <- data.frame(
y = vi[["vi_numeric"]],
x = vi[["swi_max"]]
) |>
na.omit()
# Continuous response
#Pearson R-squared
f_r2_pearson(df = df)
#Spearman R-squared
f_r2_spearman(df = df)
#R-squared of a gaussian gam
f_r2_glm_gaussian(df = df)
#gaussian glm with second-degree polynomials
f_r2_glm_gaussian_poly2(df = df)
#R-squared of a gaussian gam
f_r2_gam_gaussian(df = df)
#recursive partition tree
f_r2_rpart(df = df)
#random forest model
f_r2_rf(df = df)
#load example data
data(vi)
#reduce size to speed-up example
vi <- vi[1:1000, ]
#continuous response and predictor
#to data frame without NAs
df <- data.frame(
y = vi[["vi_numeric"]],
x = vi[["swi_max"]]
) |>
na.omit()
# Continuous response
#Pearson R-squared
f_r2_pearson(df = df)
#Spearman R-squared
f_r2_spearman(df = df)
#R-squared of a gaussian gam
f_r2_glm_gaussian(df = df)
#gaussian glm with second-degree polynomials
f_r2_glm_gaussian_poly2(df = df)
#R-squared of a gaussian gam
f_r2_gam_gaussian(df = df)
#recursive partition tree
f_r2_rpart(df = df)
#random forest model
f_r2_rf(df = df)
Run the code above in your browser using DataLab