% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ild_tvem_plot.R
\name{ild_tvem_plot}
\alias{ild_tvem_plot}
\title{Plot the time-varying coefficient from a TVEM fit}
\usage{
ild_tvem_plot(tvem_fit, n_grid = 100L, level = 0.95)
}
\arguments{
\item{tvem_fit}{A fitted object from [ild_tvem()] (class \code{tidyild_tvem}).}

\item{n_grid}{Integer. Number of points over the time range for the curve (default 100).}

\item{level}{Numeric. Confidence level for the band (default 0.95).}
}
\value{
A \code{ggplot} object (time on x-axis, estimated effect on y-axis).
}
\description{
Builds a line plot of the smooth term for the time-varying effect of the
predictor (with optional confidence band). Uses a grid over the time variable
and [mgcv::predict.gam()] with \code{type = "terms"}.
}
\examples{
set.seed(1)
d <- ild_simulate(n_id = 10, n_obs_per = 15, seed = 1)
d$x <- rnorm(nrow(d))
x <- ild_prepare(d, id = "id", time = "time")
tv <- ild_tvem(x, "y", "x", k = 5, re_id = TRUE)
ild_tvem_plot(tv)
}
