% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fracregmlogit.extractors.R
\name{fitted.fracregmlogit}
\alias{fitted.fracregmlogit}
\alias{residuals.fracregmlogit}
\alias{predict.fracregmlogit}
\alias{Extract}
\alias{fitted}
\alias{dependent}
\alias{variable,}
\alias{residuals,}
\alias{or}
\alias{predictions}
\alias{from}
\alias{a}
\alias{fractional}
\alias{multinomial}
\alias{logit}
\alias{model.}
\title{Extract Fitted Values, Residuals, and Predictions}
\usage{
\method{fitted}{fracregmlogit}(object, ...)

\method{residuals}{fracregmlogit}(object, ...)

\method{predict}{fracregmlogit}(object, newdata = NULL, newbeta = NULL, ...)
}
\arguments{
\item{object}{A "fracregmlogit" object.}

\item{...}{Additional arguments.}

\item{newdata}{A new X matrix to perform model prediction. If NULL, defaults to the original dataset. 
X can be a vector with length k, or a matrix with k columns, where k is the number of explanatory 
variables in the original model.}

\item{newbeta}{A new augmented matrix of coefficients that can be used to predict outcome variables. 
Feeds into \code{object$coefficient}, which contains the baseline coefficient. Useful for constructing
confidence intervals via simulation or bootstrapping.}
}
\value{
An object of class \code{data.frame} containing numeric values where each column corresponds to one of the choice alternatives in the response variable matrix and each row corresponds to an observation. Specifically:
\itemize{
  \item \code{fitted}: Returns the estimated fitted fractional response values (choice shares or predicted conditional probabilities).
  \item \code{residuals}: Returns the response residuals (the actual observed shares minus the estimated fitted shares).
  \item \code{predict}: Returns the predicted choice shares or conditional probabilities computed from the specified model object and \code{newdata} or \code{newbeta}.
}
}
\description{
Extract Fitted Values, Residuals, and Predictions
}
\examples{
data("fracreg_spending")
df <- na.omit(fracreg_spending)
X = df[,2:5]
y = df[,6:11]
results1 = fracregmlogit(y, X)

# Extract fitted values
fit = fitted(results1)

# Extract residuals
res = residuals(results1)

# Predict using the first observation from the original dataset
pred = predict(results1, newdata = X[1,])
}
\seealso{
\code{\link{fracregmlogit}}
}
