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 ~ ., data = mtcars))
#> D-vine regression model: mpg | disp, wt, hp, gear, cyl, vs, qsec
#> nobs = 32, edf = 9, cll = -58.41, caic = 134.82, cbic = 148.01
summary(fit)
#> var edf cll caic cbic p_value
#> 1 mpg 0 -100.189867 200.3797334 200.3797334 NA
#> 2 disp 1 27.086917 -52.1738350 -50.7080991 1.835143e-13
#> 3 wt 1 2.676766 -3.3535326 -1.8877967 2.068033e-02
#> 4 hp 1 3.983133 -5.9662654 -4.5005295 4.765716e-03
#> 5 gear 1 1.392314 -0.7846281 0.6811078 9.517278e-02
#> 6 cyl 2 3.116818 -2.2336361 0.6978357 4.429790e-02
#> 7 vs 2 2.458009 -0.9160183 2.0154535 8.560521e-02
#> 8 qsec 1 1.065405 -0.1308095 1.3349264 1.443645e-01
# show marginal effects for all selected variables
plot_effects(fit)
#> `geom_smooth()` using method = 'loess' and formula 'y ~ x'