% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/make_pred_plot.R
\name{make_pred_plot}
\alias{make_pred_plot}
\title{Prediction Power Heatmap}
\usage{
make_pred_plot(mat, title, low = "azure4", high = "white", text_size = 2.5)
}
\arguments{
\item{mat}{matrix returned by \code{\link{prediction_power}}. Entries should
contain expected conditional entropies \emph{EH(Z|X,Y)}.}

\item{title}{character string giving the plot title.}

\item{low}{color for low expected conditional entropy values. Default is
\code{"steelblue"}.}

\item{high}{color for high expected conditional entropy values. Default is
\code{"white"}.}

\item{text_size}{numeric value controlling the size of the cell labels.
Default is 2.5.}
}
\value{
A \code{ggplot} object showing a heatmap of expected conditional
entropy values. Darker cells indicate lower prediction uncertainty and
therefore higher prediction power.
}
\description{
Creates a heatmap for visualizing prediction power from a
prediction power matrix.
}
\details{
The plot visualizes expected conditional entropies
\deqn{EH(Z|X,Y)}
where \emph{Z} is the target variable and \emph{X} and \emph{Y} are predictors.
Diagonal entries correspond to prediction using a single predictor,
\emph{EH(Z|X)}, while off-diagonal entries correspond to prediction using
pairs of predictors, \emph{EH(Z|X,Y)}. Lower values indicate stronger
predictive power.
}
\examples{
# use internal data set
data(lawdata)

# extract node attributes
df_att <- lawdata[[4]]

# data editing:
# 1. discretize 'years' and 'age' into 3 categories
# 2. ensure values start at 0 where needed
att_var <- data.frame(
  status    = df_att$status - 1,
  gender    = df_att$gender,
  office    = df_att$office - 1,
  years     = ifelse(df_att$years <= 3, 0,
                ifelse(df_att$years <= 13, 1, 2)),
  age       = ifelse(df_att$age <= 35, 0,
                ifelse(df_att$age <= 45, 1, 2)),
  practice  = df_att$practice,
  lawschool = df_att$lawschool - 1
)

# compute prediction power matrix for 'status'
pred_mat <- prediction_power("status", att_var)

# visualize prediction power
make_pred_plot(pred_mat, "Prediction Power for Status")
}
\seealso{
\code{\link{prediction_power}}, \code{\link{entropy_trivar}}
}
