View source: R/pridit_longitudinal.R
| pridit_longitudinal | R Documentation |
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.
pridit_longitudinal(
data,
id_col,
time_col,
indicator_cols = NULL,
sign_correction = TRUE
)
data |
A data frame in long format containing columns identified by
|
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 |
indicator_cols |
Character vector of indicator column names to include.
If |
sign_correction |
Logical. Passed to |
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).
An object of class "pridit_longitudinal", a list with:
fitsNamed list of "pridit" objects, one per period.
weight_corsSymmetric matrix of Pearson correlations between period weight vectors.
score_corsSymmetric matrix of Spearman rank correlations between period scores on the balanced panel.
scores_wideData frame of scores in wide format (one column per period) for the balanced panel.
weights_longData frame of weights in long format with
columns period, indicator, weight.
periodsSorted vector of period labels.
n_balancedNumber of observations in the balanced panel.
callMatched call.
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.
pridit, autoplot.pridit_longitudinal
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
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.