% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/fracregmlogit.plot.R
\name{plot.fracregmlogit}
\alias{plot.fracregmlogit}
\title{Plot Marginal or Discrete Effects of Willingness to Pay}
\usage{
\method{plot}{fracregmlogit}(
  x,
  wtp.vec = NULL,
  varlist = NULL,
  against = NULL,
  mfrow = NULL,
  t = 500,
  effect = c("discrete", "marginal"),
  type = NULL,
  plot.show = TRUE,
  ...
)
}
\arguments{
\item{x}{A "fracregmlogit" object.}

\item{wtp.vec}{A numeric vector for willingness to pay.}

\item{varlist}{A string vector which provides the names of variables to plot the effect for.
If missing, all variables in the object will be plotted.}

\item{against}{A vector with the same length as the number of observations in the model, or the name of a variable. 
Serves as the x-axis in the plots.}

\item{mfrow}{A numeric vector with two elements. Specifies the number of rows and columns in a panel.
Similar to par(mfrow=c()). Default to NULL, and the program will choose a square panel.}

\item{t}{Number of points to be used for smoothing.}

\item{effect}{The type of effect ("marginal" or "discrete").}

\item{type}{Plot type.}

\item{plot.show}{If TRUE, the plot will be created. Otherwise, the function returns raw data that can be
used to create user-specified (custom) plots.}

\item{...}{Additional arguments.}
}
\value{
Panel plots of effects vs. chosen variables.
}
\description{
Plot marginal or discrete effects of willingness to pay, potentially against another variable.
}
\details{
This function provides a visualisation tool for potentially heterogeneous marginal and discrete effects of willingness to pay.
The function allows the user to plot marginal effects to detect any patterns in the effects, in itself
and against other variables. The plot also allows visualisation of sub-groups in data, which can be
very useful to visualise categorical and dummy variables. 

The function takes a \code{fracregmlogit} object, and internally calls \code{wtp} and \code{fracregmlogit.pe} 
to compute the willingness to pay at different data points.

Additional parameters include \code{varlist}, a vector of string variable names to be plotted. 
 
\code{against} allows a different variable to be chosen
as the x-axis. \code{against} can supply the column name of a variable in the original dataset to plot against.
}
\examples{
data("fracreg_spending")
X = fracreg_spending[,2:5]
y = fracreg_spending[,6:11]
results1 = fracregmlogit(y, X)

# Define a willingness to pay vector
wtp.vec = c(1, 1, 1, 1, 1, 1)

# Plot WTP for 'popdens'
plot(results1, wtp.vec=wtp.vec, varlist="popdens")
}
\seealso{
\code{\link{wtp}}, \code{\link{fracregmlogit.pe}}
}
