% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/nmfkc.R
\name{nmfkc.kernel}
\alias{nmfkc.kernel}
\title{Create a kernel matrix from covariates}
\source{
Satoh, K. (2024). Applying Non-negative Matrix Factorization with Covariates to the Longitudinal Data as Growth Curve Model.
arXiv preprint arXiv:2403.05359. \url{https://arxiv.org/abs/2403.05359}
}
\usage{
nmfkc.kernel(
  U,
  V = NULL,
  kernel = c("Gaussian", "Exponential", "Periodic", "Linear", "NormalizedLinear",
    "Polynomial"),
  ...
)
}
\arguments{
\item{U}{Covariate matrix \eqn{U(K,N) = (u_1, \dots, u_N)}. Each row may be normalized in advance.}

\item{V}{Covariate matrix \eqn{V(K,M) = (v_1, \dots, v_M)}, typically used for prediction. If \code{NULL}, the default is \code{U}.}

\item{kernel}{Kernel function to use. Default is \code{"Gaussian"}. Options are \code{"Gaussian"}, \code{"Exponential"}, \code{"Periodic"}, \code{"Linear"}, \code{"NormalizedLinear"}, and \code{"Polynomial"}.}

\item{...}{Additional arguments passed to the specific kernel function (e.g., \code{beta}, \code{degree}).}
}
\value{
Kernel matrix \eqn{A(N,M)}.
}
\description{
\code{nmfkc.kernel} constructs a kernel matrix from covariate matrices.
It supports Gaussian, Exponential, Periodic, Linear, Normalized Linear, and Polynomial kernels.
}
\examples{
# Example.
Y <- matrix(cars$dist,nrow=1)
U <- matrix(c(5,10,15,20,25),nrow=1)
V <- matrix(cars$speed,nrow=1)
A <- nmfkc.kernel(U,V,beta=28/1000)
dim(A)
result <- nmfkc(Y,A,rank=1)
plot(as.vector(V),as.vector(Y))
lines(as.vector(V),as.vector(result$XB),col=2,lwd=2)
}
\seealso{
\code{\link{nmfkc.kernel.gaussian}}, \code{\link{nmfkc.cv}}
}
