% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nmfkc.R
\name{predict.nmfkc}
\alias{predict.nmfkc}
\title{Prediction method for objects of class \code{nmfkc}}
\usage{
\method{predict}{nmfkc}(object, newA = NULL, newdata = NULL, type = "response", ...)
}
\arguments{
\item{object}{An object of class \code{nmfkc}, i.e., the return value of \code{nmfkc}.}

\item{newA}{Optional. A new covariate matrix to be used for prediction.}

\item{newdata}{Optional data frame. Only available when the model was fitted
using a formula. Covariate columns are extracted automatically using the
stored formula metadata. If both \code{newdata} and \code{newA} are
supplied, \code{newdata} takes precedence (with a warning).}

\item{type}{Type of prediction to return. Options are "response" (fitted values matrix),
"prob" (soft-clustering probabilities), or "class" (hard-clustering labels based on row names of X).}

\item{...}{Further arguments passed to or from other methods.}
}
\value{
Depending on \code{type}: a numeric matrix (\code{"response"} or \code{"prob"})
or a character vector of class labels (\code{"class"}).
}
\description{
\code{predict.nmfkc} generates predictions from an object of class \code{nmfkc},
either using the fitted covariates or a new covariate matrix.

When the model was fitted using a formula (Formula Mode), a \code{newdata}
data frame can be supplied instead of \code{newA}; the covariate matrix is
then constructed automatically from the stored formula metadata.
}
\examples{
# Prediction with newA
Y <- matrix(cars$dist, nrow = 1)
A <- rbind(1, cars$speed)
result <- nmfkc(Y, A, rank = 1)
newA <- rbind(1, c(10, 20, 30))
predict(result, newA = newA)

}
\seealso{
\code{\link{nmfkc}}, \code{\link{nmfkc.cv}}
}
