pridit_longitudinal: Longitudinal PRIDIT analysis

View source: R/pridit_longitudinal.R

pridit_longitudinalR Documentation

Longitudinal PRIDIT analysis

Description

Fits a separate PRIDIT model for each time period in a panel data set and summarises the stability of scores and weights across periods. The analysis follows Lieberthal & Comer (2013), who demonstrated that PRIDIT weights computed on one year's Hospital Compare data predict out-of-period outcomes in the following year, with cross-year weight correlations exceeding 0.99.

Usage

pridit_longitudinal(
  data,
  id_col,
  time_col,
  indicator_cols = NULL,
  sign_correction = TRUE
)

Arguments

data

A data frame in long format containing columns identified by id_col, time_col, and at least two numeric indicator columns.

id_col

Character. Name of the observation identifier column.

time_col

Character. Name of the time-period column. Periods are processed in the order returned by sort(unique(data[[time_col]])).

indicator_cols

Character vector of indicator column names to include. If NULL (default), all numeric columns other than the ID and time columns are used.

sign_correction

Logical. Passed to pridit. Default TRUE.

Details

Because the PCA sign is arbitrary, each period's weight vector is aligned to the first period before computing cross-period correlations: if the Pearson correlation between a replicate's weights and the first period's weights is negative, the replicate is sign-flipped.

Cross-period score correlations are computed only for the balanced panel (observations present in all periods).

Value

An object of class "pridit_longitudinal", a list with:

fits

Named list of "pridit" objects, one per period.

weight_cors

Symmetric matrix of Pearson correlations between period weight vectors.

score_cors

Symmetric matrix of Spearman rank correlations between period scores on the balanced panel.

scores_wide

Data frame of scores in wide format (one column per period) for the balanced panel.

weights_long

Data frame of weights in long format with columns period, indicator, weight.

periods

Sorted vector of period labels.

n_balanced

Number of observations in the balanced panel.

call

Matched call.

References

Lieberthal, R. D., & Comer, D. M. (2013). What are the characteristics that explain hospital quality? A longitudinal PRIDIT approach. Risk Management and Insurance Review, 17(1), 17–35.

See Also

pridit, autoplot.pridit_longitudinal

Examples

set.seed(1)
dat <- data.frame(
  id   = rep(letters[1:20], times = 3),
  year = rep(2020:2022, each = 20),
  x1   = runif(60),
  x2   = runif(60),
  x3   = runif(60)
)
fit_long <- pridit_longitudinal(dat, id_col = "id", time_col = "year")
fit_long


pridit documentation built on May 31, 2026, 5:07 p.m.