An R package for D-vine copula based mean and quantile regression.
See the package website.
set.seed(5)
library(vinereg)
data(mtcars)
# declare factors and discrete variables
for (var in c("cyl", "vs", "gear", "carb"))
mtcars[[var]] <- as.ordered(mtcars[[var]])
mtcars[["am"]] <- as.factor(mtcars[["am"]])
# fit model
(fit <- vinereg(mpg ~ ., family = "nonpar", data = mtcars))
#> D-vine regression model: mpg | disp, qsec, hp, drat
#> nobs = 32, edf = 25.6, cll = -51.94, caic = 155.08, cbic = 192.61
summary(fit)
#> var edf cll caic cbic p_value
#> 1 mpg 0.000000 -100.189867 200.379733 200.379733 NA
#> 2 disp 13.187762 29.521786 -32.668047 -13.338271 9.065782e-08
#> 3 qsec 2.272103 4.454079 -4.363952 -1.033648 1.559593e-02
#> 4 hp 7.178554 10.836467 -7.315826 3.206038 3.267907e-03
#> 5 drat 2.965553 3.441702 -0.952298 3.394419 7.382604e-02
# show marginal effects for all selected variables
plot_effects(fit)
#> `geom_smooth()` using method = 'loess' and formula = 'y ~ x'