% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nmfre.R
\name{nmfre.inference}
\alias{nmfre.inference}
\title{Statistical inference for the coefficient matrix C from NMF-RE}
\usage{
nmfre.inference(object, Y, A = NULL, wild.bootstrap = TRUE, ...)
}
\arguments{
\item{object}{An object of class \code{"nmfre"} returned by
\code{\link{nmfre}}.}

\item{Y}{Observation matrix (P x N). Must match the data used in
\code{nmfre()}.}

\item{A}{Covariate matrix (K x N). Default is \code{NULL} (intercept only).}

\item{wild.bootstrap}{Logical. If \code{TRUE} (default), performs wild
bootstrap for confidence intervals and bootstrap standard errors.}

\item{...}{Additional arguments:
\describe{
\item{\code{wild.B}}{Number of bootstrap replicates. Default is 500.}
\item{\code{wild.seed}}{Seed for bootstrap. Default is 123.}
\item{\code{wild.level}}{Confidence level for bootstrap CI. Default is 0.95.}
\item{\code{C.p.side}}{P-value type: \code{"one.sided"} (default) or \code{"two.sided"}.}
\item{\code{cov.ridge}}{Ridge stabilization. Default is 1e-8.}
\item{\code{print.trace}}{Logical. Default is \code{FALSE}.}
}}
}
\value{
The input \code{object} with additional inference components:
\item{sigma2.used}{Estimated \eqn{\sigma^2} used for inference.}
\item{C.vec.cov}{Full covariance matrix for \eqn{vec(C)}.}
\item{C.se}{Sandwich standard errors for \eqn{C}.}
\item{C.se.boot}{Bootstrap standard errors for \eqn{C}.}
\item{C.ci.lower}{Lower CI bounds for \eqn{C}.}
\item{C.ci.upper}{Upper CI bounds for \eqn{C}.}
\item{coefficients}{Data frame with Basis, Covariate, Estimate, SE, BSE,
z_value, p_value, CI_low, CI_high.}
\item{C.p.side}{P-value type used.}
}
\description{
\code{nmfre.inference} performs statistical inference on the coefficient
matrix \eqn{C} (\eqn{\Theta}) from a fitted \code{nmfre} model,
conditional on the estimated basis matrix \eqn{\hat{X}} and random
effects \eqn{\hat{U}}.

Under the working model \eqn{Y^* = Y - X\hat{U} \approx X C A + \varepsilon},
inference is conducted via sandwich covariance estimation and
one-step wild bootstrap with non-negative projection.

The result is compatible with \code{\link{nmfkc.DOT}} for visualization
(pass the result directly as \code{x} with \code{type = "YXA"}).
}
\examples{
Y <- matrix(cars$dist, nrow = 1)
A <- rbind(intercept = 1, speed = cars$speed)
res <- nmfre(Y, A, rank = 1, wild.bootstrap = FALSE)
res2 <- nmfre.inference(res, Y, A)
res2$coefficients

}
\references{
Satoh, K. (2026). Wild Bootstrap Inference for Non-Negative Matrix
Factorization with Random Effects. arXiv:2603.01468.
\url{https://arxiv.org/abs/2603.01468}
}
\seealso{
\code{\link{nmfre}}, \code{\link{nmfkc.DOT}},
\code{\link{summary.nmfre}}
}
