% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/long-grmtree-itempar.R
\name{itempar_longitudinal_grmtree}
\alias{itempar_longitudinal_grmtree}
\title{Extract Item Parameters from Longitudinal GRM Tree}
\usage{
itempar_longitudinal_grmtree(object, node = NULL, clean_names = TRUE, ...)
}
\arguments{
\item{object}{A \code{longitudinal_grmtree} object.}

\item{node}{Optional vector of node IDs. If NULL, all terminal nodes.}

\item{clean_names}{Logical. If TRUE (default), clean item names.}

\item{...}{Additional arguments (currently unused).}
}
\value{
A data.frame with columns:
\describe{
\item{Node}{Terminal node ID}
\item{Item}{Item name}
\item{Discrimination}{Discrimination parameter}
\item{AvgThreshold}{Mean of all threshold parameters for the item}
\item{b1, b2, ..., bK}{Individual threshold parameters}
}
}
\description{
Extracts both discrimination and threshold parameters for each unique item
from all terminal nodes, combining them into a single data frame with an
average threshold column. Only T1 items are returned.
}
\examples{
\dontshow{if (interactive()) withAutoprint(\{ # examplesIf}
library(grmtree)

# Load the synthetic longitudinal data
data("grmtree_long_data", package = "grmtree")

  # Prepare the wide-format response matrix
  items_t1 <- c("MOS_Listen", "MOS_Info", "MOS_Advice_Crisis", "MOS_Confide",
                "MOS_Advice_Want", "MOS_Fears", "MOS_Personal", "MOS_Understand")
  ld <- prepare_longitudinal_data(
    data = grmtree_long_data,
    items_t1 = items_t1,
    items_t2 = paste0(items_t1, "_year1"),
    covariates = c("sex", "age", "residency", "job",
                   "education", "comorbidity_count", "ever_smoker")
  )

  # Phase 1: fit the longitudinal GRM tree
  ltree <- longitudinal_grmtree(
    resp_wide ~ sex + age + residency + job +
      education + comorbidity_count + ever_smoker,
    data = ld, n_items = 8,
    control = grmtree.control(minbucket = 200)
  )

  # Print the item parameters
  items <- itempar_longitudinal_grmtree(ltree)
  print(items)
\dontshow{\}) # examplesIf}
}
\seealso{
\code{\link{longitudinal_grmtree}} for Phase 1 (tree fitting),
\code{\link{discrpar_longitudinal_grmtree}} for extracting discrimination
parameters for longitudinal GRMTree,
\code{\link{threshpar_longitudinal_grmtree}} for extracting threshold
parameters for longitudinal GRMTree
}
