% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/predict_spBPS_new.R
\name{predict.spBPS}
\alias{predict.spBPS}
\title{Predict at new locations using a fitted spBPS model}
\usage{
\method{predict}{spBPS}(
  object,
  newdata,
  draws = 200L,
  pred_batch_size = 200L,
  n_cores = 1L,
  return_summary = FALSE,
  probs = c(0.025, 0.975),
  ...
)
}
\arguments{
\item{object}{Object of class \code{"spBPS"} returned by \code{spBPS()}.}

\item{newdata}{List with elements \code{X} (u x p covariate matrix) and \code{coords} (u x d coordinate matrix).}

\item{draws}{Integer. Number of posterior predictive draws. Default 200.}

\item{pred_batch_size}{Integer. Number of prediction sites processed per batch. Default 200. Smaller values use less RAM; larger values may be faster.}

\item{n_cores}{Integer. Number of OMP threads. Default 1.}

\item{return_summary}{Logical. If \code{FALSE} (default) return full draw arrays. If \code{TRUE} return summary statistics.}

\item{probs}{Numeric vector of length 2. Quantile probabilities for credible intervals when \code{return_summary = TRUE}. Default \code{c(0.025, 0.975)}.}

\item{...}{Currently unused.}
}
\value{
When \code{return_summary = FALSE}, a list with arrays \code{Wu},
\code{Yu}, \code{MY} of dimension u x q x R.
When \code{return_summary = TRUE}, a list with u x q matrices
\code{mu_Yu}, \code{sd_Yu}, \code{q_lo}, \code{q_hi}, \code{mu_Wu}.
}
\description{
Generates posterior predictive samples at new spatial locations using a
fitted \code{spBPS} object. Memory usage is controlled via
\code{pred_batch_size}
}
\examples{
\donttest{
n <- 1000
p <- 2
q <- 1

Y <- matrix(rnorm(n * q), ncol = q)
X <- matrix(rnorm(n * p), ncol = p)
coords <- matrix(runif(n * 2), ncol = 2)

data    <- list(Y = Y, X = X)
priors  <- list(mu_B = matrix(0, nrow = p, ncol = q),
                V_r  = diag(10, p),
                Psi  = diag(1, q),
                nu   = 3)
hyperpar <- list(alpha = 0.5, phi = 1)

res <- spBPS(data, priors, coords, hyperpar, subset_size = 200)

u <- 500
p <- 2
q <- 1

X_u <- matrix(rnorm(u * p), ncol = p)
crd_u <- matrix(runif(u * 2), ncol = 2)

# Predictive sampling
pred <- predict(res, newdata=list(X=X_u, coords=crd_u),
                draws=200L, pred_batch_size=500L)

# Summary statistics only (memory-efficient for large u)
pred_sum <- predict(res, newdata=list(X=X_u, coords=crd_u),
                    draws=500L, return_summary=TRUE,
                    probs=c(0.025, 0.975))
}


}
\seealso{
\code{\link{spBPS}}
}
