Computes a smoothed per-actor time-varying slope coefficient on a
slice of the combined dyadic design array (fit$Xlist). For
kind = "row", each row-actor \(i\) gets a length-\(T\) slope
path \(\beta_{i,t}\) on the across-column mean of design slice
covariate_idx, fit by ridge-penalised least squares on the
response-scale residual Y - YPM (the observed value minus the
posterior predictive mean) after the main MCMC components;
kind = "col" uses the across-row mean for each column-actor.
Usage
per_actor_slopes(fit, kind = c("row", "col"), covariate_idx = 1L, lambda = 1)Arguments
- fit
A fitted
lameobject.- kind
"row"(default; per-row-actor slopes) or"col"(per-column-actor slopes).- covariate_idx
Integer index into the third (covariate) dimension of the combined dyadic design array
fit$Xlist. Slice 1 is the intercept; dyadic covariates follow. Default1L.- lambda
Non-negative smoothing parameter (first-difference penalty across periods). Default
1.
Value
A list with slopes (an \(n_{actors} \times T\)
matrix), kind, covariate_idx, lambda,
and label. Class "per_actor_slopes".
Examples
# \donttest{
data(YX_bin_list)
# chains = 1 keeps the example short; the default runs two chains and compares them
fit <- lame(lapply(YX_bin_list$Y, function(y) 1 * (y > 0)), YX_bin_list$X, family = "binary", R = 0,
nscan = 100, burn = 25, odens = 5, verbose = FALSE, chains = 1)
# post-MCMC per-row-actor slopes on the first dyadic covariate
pas <- per_actor_slopes(fit, kind = "row", lambda = 1)
dim(pas$slopes)
#> [1] 50 4
# }