predict.SPQR | R Documentation |
SPQR
Computes the predicted values for different functions based on the fitted "SPQR"
object.
## S3 method for class 'SPQR' predict( object, X, Y = NULL, nY = 101, type = c("QF", "PDF", "CDF"), tau = seq(0.1, 0.9, 0.1), ci.level = 0, getAll = FALSE, ... )
object |
An object of class |
X |
The covariate vector/matrix for which the predictions are computed. |
Y |
The response vector for which the predictions are computed. Default is |
nY |
An integer number indicating length of grid when |
type |
The function to be predicted; |
tau |
The grid of quantiles for which the quantile function is computed. Default: |
ci.level |
The credible level for computing the pointwise credible intervals. The default is 0 indicating no credible intervals should be computed. |
getAll |
If |
... |
Other arguments. |
A named array containing all predicted values.
set.seed(919) n <- 200 X <- rbinom(n, 1, 0.5) Y <- rnorm(n, X, 0.8) control <- list(iter = 200, warmup = 150, thin = 1) fit <- SPQR(X = X, Y = Y, method = "MCMC", control = control, normalize = TRUE, verbose = FALSE) ## compute the estimated PDF of Y conditioned on X = 0 pdf <- predict(fit, type = "PDF", X = 0, Y = seq(0, 1, 0.01)) plot(seq(0, 1, 0.01), pdf, xlab = "Y", ylab = "Density")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.