% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/spBPS.R
\name{spBPS_old}
\alias{spBPS_old}
\title{Unified spatial BPS workflow (multivariate path, works for q = 1)}
\usage{
spBPS_old(
  data,
  priors,
  coords,
  hyperpar,
  subset_size = 500L,
  K = NULL,
  cv_folds = 5L,
  rp = 1,
  combine_method = c("bps", "pseudoBMA"),
  draws = 0L,
  newdata = NULL,
  include_latent = FALSE,
  cores = NULL
)
}
\arguments{
\item{data}{List with matrices \code{Y} (response) and \code{X} (covariates).}

\item{priors}{List of priors for the multivariate model (\code{mu_B}, \code{V_r},
\code{Psi}, \code{nu}).}

\item{coords}{Matrix of observation coordinates.}

\item{hyperpar}{List with elements \code{alpha} and \code{phi} (vectors allowed).}

\item{subset_size}{Target subset size when \code{K} is not provided. Default 500.}

\item{K}{Optional number of subsets. When \code{NULL}, computed as
\code{ceiling(nrow(Y) / subset_size)} and lower-bounded at 1.}

\item{cv_folds}{Number of folds for local cross-validation (default 5).}

\item{rp}{Fraction of rows used when recomputing global stacking weights
(passed to \code{BPS_combine}). Ignored when \code{combine_method = "pseudoBMA"}.}

\item{combine_method}{Choose between Bayesian Predictive Stacking (\code{"bps"})
or pseudo-BMA (\code{"pseudoBMA"}) for combining subsets.}

\item{draws}{Number of joint posterior/predictive draws to return (0 to
skip). When positive, \code{newdata} must be supplied because draws are obtained
via \code{BPS_post_MvT} which jointly samples posterior and predictive.}

\item{newdata}{Optional list with \code{X} and \code{coords} for prediction locations;
required when either draw count is positive.}

\item{include_latent}{Logical; if \code{TRUE}, posterior draws include latent
processes.}

\item{cores}{Optional integer; when >1 a parallel backend is registered
internally via \code{doParallel::registerDoParallel(cores)} for the fit and draw
loops. When \code{NULL}, the existing foreach backend (if any) is used.}
}
\value{
List with components \code{subsets}, \code{weights_global}, \code{weights_local},
\code{epd}, and optional \code{posterior} and \code{predictive} draws.
}
\description{
Orchestrates subsetting, local stacking weight estimation, global stacking
combination, and optional posterior or predictive simulation using the
multivariate Student-t spatial model. Works for both multivariate outcomes
and the univariate case via \code{q = 1}.
}
\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)
subset_size <- 200

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

}

}
