View source: R/predict.vinereg.R
predict.vinereg | R Documentation |
Predict conditional mean and quantiles from a D-vine regression model
## S3 method for class 'vinereg' predict(object, newdata, alpha = 0.5, cores = 1, ...) ## S3 method for class 'vinereg' fitted(object, alpha = 0.5, ...)
object |
an object of class |
newdata |
matrix of covariate values for which to predict the quantile. |
alpha |
vector of quantile levels; |
cores |
integer; the number of cores to use for computations. |
... |
unused. |
A data.frame of quantiles where each column corresponds to one
value of alpha
.
vinereg
# simulate data x <- matrix(rnorm(200), 100, 2) y <- x %*% c(1, -2) dat <- data.frame(y = y, x = x, z = as.factor(rbinom(100, 2, 0.5))) # fit vine regression model (fit <- vinereg(y ~ ., dat)) # inspect model summary(fit) plot_effects(fit) # model predictions mu_hat <- predict(fit, newdata = dat, alpha = NA) # mean med_hat <- predict(fit, newdata = dat, alpha = 0.5) # median # observed vs predicted plot(cbind(y, mu_hat)) ## fixed variable order (no selection) (fit <- vinereg(y ~ ., dat, order = c("x.2", "x.1", "z.1")))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.