Learn R Programming

lame (version 1.3.4)

Longitudinal Additive and Multiplicative Effects Models for Networks

Description

Additive and multiplicative effects models for both cross-sectional and longitudinal network analysis. The package provides two main functions: ame() for cross-sectional networks and lame() for longitudinal networks. It supports square and rectangular network structures. Key features include: (1) Cross-sectional network analysis via ame() with support for binary, continuous, ordinal, and count data; (2) Longitudinal network analysis via lame() with additive sender/receiver and multiplicative latent-factor effects that can evolve over time through AR(1) processes (Sewell and Chen (2015) ; Durante and Dunson (2014) ); (3) Handling of changing actor compositions across time periods in longitudinal models; (4) Performance improvements through C++ implementations via 'Rcpp' and 'RcppArmadillo'.

Copy Link

Version

Install

install.packages('lame')

Version

1.3.4

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Shahryar Minhas

Last Published

August 4th, 2026

Functions in lame (1.3.4)

YX_ord

ordinal relational data and covariates
ame_memory_usage

Calculate memory usage of AME model components
ame_als_refit

Refit a fast AME model with a warm start
array_to_list

Convert array to list.
ame_als_bootstrap

Bootstrap uncertainty for the fast AME estimator
ame_options

AME model fitting options
ame

AME model fitting routine
ame_memory_settings

Display memory usage information for AME models
ame_parallel

Run AME model with multiple parallel chains
ame_als

Fast (MCMC-free) AME estimation for a cross-sectional network
as_draws

Generic dispatcher for posterior::as_draws on lame fits
as_lame_y

Convert a graph object to a lame-ready adjacency matrix
bipartite_helpers

Bipartite network helper functions
boot_ame-no-fitted

fitted/residuals are not defined for a bootstrap object
check_format

Validate input data format for lame function
coef.als_dynamic_beta

Extract beta path from a penalised-ALS object
as_draws.ame

Convert an AME / LAME fit to a posterior draws object
confint.ame

Bayesian credible intervals for AME model parameters
compute_XtX_Xty_bip_cpp

Compute X'X and X'y for bipartite covariate regression
confint.ame_als

Confidence intervals for a fast AME fit
compact_ame

Optimize AME model output for memory efficiency
autoplot.ame_als

autoplot method for ALS fits
compute_mcmc_diagnostics

Compute MCMC convergence diagnostics for multiple chains
coef.boot_ame

Point estimates from a fast AME bootstrap
combine_ame_chains

Combine multiple AME chains
coef.ame_als

Extract coefficients from a fast AME fit
comtrade

Comtrade data
autoplot.lame

Ribbon plot of time-varying coefficients (or coefplot for static fits)
coef.ame

Extract model coefficients from AME model
coldwar

Cold War data
design_array_listwisedel

Computes the design socioarray of covariate values
.build_full_design

Build the full canonical design for a newdata prediction
compute_gof_bipartite

Compute GOF statistics for bipartite networks
.actor_ffbs_path

Univariate Carter-Kohn FFBS for one actor's length-T slope path
detect_change_point

Detect potential change points in a dynamic_beta posterior path
.ame_propagate_cov_na

Propagate covariate missingness into the response
.exact_center_per_actor

Exact variance-weighted sum-to-zero projection for the per-actor block
.reorder_newdata_actors

Realign a newdata covariate array to the fit's internal actor order
confint.boot_ame

Confidence intervals from a fast AME bootstrap
design_array

Assemble the dyadic design socioarray for an AME model
fitted.ame_als

Extract fitted values from a fast AME fit
fitted.ame

Extract fitted values from AME model
.fit_actor_order

The fit's internal (canonical) actor order
dynamic_beta_prior_summary

Summarise the implied prior on a time-varying coefficient path
el2sm

Edgelist to sociomatrix
evaluate_heldout

Held-out predictive evaluation for an ame / lame fit
.rotation_drift_diagnostic

Rotation-drift diagnostic for the canonical (U_t, G_t, V_t) trio
.sweep_per_actor_exact

Per-actor sweep: unconstrained per-actor FFBS + exact projection
ffbs_vecG

Forward-filter / backward-sample for vec(G_t) under AR(1) state prior
glance.ame_als

Glance method for fitted ame_als / lame_als objects
glance.ame

Glance method for fitted ame / lame objects
get_fit_object

Get fitted object from MCMC results
get_start_vals

Get fitted object from MCMC results
get_design_rep

Create design array for replicate data
forecast_pit

Probability-integral-transform calibration check for h-step forecasts
dutchcollege

Dutch college data
fitted.lame

Extract fitted values from LAME model
glance

S3 generic for glance
get_EZ_dynamic_beta_cpp

Compute EZ when beta is time-varying
formula.ame

formula() is not defined for an ame() / lame() fit
init_dynamic_positions

Initialize dynamic latent positions with AR(1) structure
gof

Compute GOF statistics from saved posterior samples
gof_temporal

Posterior-predictive temporal-trend test
init_dynamic_ab_cpp

Initialize dynamic additive effects with AR(1) structure
gof_stats

Goodness of fit statistics
gof_plot.ame_als

Goodness-of-fit check for an ame_als fit
latent_positions

Extract latent positions as a tidy data frame
gof_plot

Visualize goodness-of-fit statistics for AME and LAME models
lame-package

Longitudinal Additive and Multiplicative Effects Models for Networks
gof_stats_bipartite

Goodness of fit statistics for bipartite networks
.xbeta_newdata

Name-safe linear predictor from a newdata prediction
list_to_array

Convert list to array
lfo

Exact rolling-origin leave-future-out cross-validation
lazegalaw

Lazega's law firm data
gof_stats_unipartite

Goodness of fit statistics for unipartite networks
lame_als

Fast (MCMC-free) AME estimation for a longitudinal network
lame_multi

Multi-panel lame() with shared coefficients
loo

Generic dispatcher for loo / waic on ame / lame fits
loo.ame

Approximate leave-one-out cross-validation for AME / LAME fits
nobs.ame

Number of observed dyads in an AME / LAME fit
lame_parallel

Run LAME (longitudinal AME) with multiple parallel chains
mhalf

Symmetric square root of a matrix
log_phi_diff

Numerically stable log(Phi(hi) - Phi(lo))
lame

AME model fitting routine for longitudinal relational data
logLik.ame

Log-likelihood is not directly exposed for ame() / lame() fits
lame_snap_als

Fast approximate dynamic snap-shift AME estimator
list_to_array_bipartite

Convert bipartite list data to array format
logLik.ame_als

Log-likelihood is not defined for a fast AME fit
per_actor_slopes

Post-MCMC per-actor time-varying slopes
lame_resume

Resume a lame() MCMC run from a checkpoint
posterior_options

Options for saving posterior samples during MCMC
plot.ame

Simple diagnostic plot for AME model fit
print.ame

Print method for AME model objects
print.als_dynamic_beta

Print method for penalised ALS time-varying beta
print.lame

Print method for LAME objects
posterior_quantiles

Extract posterior quantiles for model components
print.gof_temporal

Print method for gof_temporal output
nodematch

ERGM-style covariate helpers for ame() / lame()
prior_summary

Print the priors used by an AME / LAME / ame_als fit
print.ame.sim

Print methods for AME and LAME simulation objects
plot.ame_als

Plot the convergence of a fast AME fit
nobs.ame_als

Number of observed dyads in an ame_als fit
rSab_fc

Gibbs update for additive effects covariance
plot.lame

Plot diagnostics for a LAME model fit
rSuv_fc

Gibbs update for multiplicative effects covariance
predict.ame_als

Predictions from a fast AME fit
predict.lame

Predict method for LAME models
precomputeX

Precompute design-array cross-product summaries
rUV_dynamic_bip_fc_cpp

Bipartite dynamic UV Gibbs update
print.lame_multi

Print method for lame_multi
rUV_sym_fc

Gibbs sampling of U and V
rUV_dynamic_t_fc_cpp

Update dynamic latent positions with heavy-tailed (Student-t) AR(1) innovations
print.summary.ame_als

Print a fast AME summary
print.summary.ame

Print method for summary.ame objects
print.boot_ame

Print bootstrap results for a fast AME fit
print.ame_als

Print an ame_als object
print.per_actor_slopes

Print method for per_actor_slopes
predict.ame

Predict method for AME models
prediction_draws_long

Long-format draws of the linear predictor for marginaleffects-style use
print.lfo_lame

Print method for lfo() results
rUV_fc

Gibbs sampling of U and V
rUV_rep_fc

Gibbs sampling of U and V from replicated relational data
print.summary.lame

Print method for summary.lame objects
rUV_dynamic_fc_cpp

Update dynamic latent positions using AR(1) process
rUV_dynamic_fc

Gibbs sampling of dynamic U and V with AR(1) evolution
rZ_bin_bip_batch_cpp

Batch binary Z sampling across all time periods (bipartite, rho=0)
rUV_dynamic_snap_fc

Gibbs sampling of dynamic U and V with snap-shift dynamics
rZ_bin_fc

Draw latent Z for the binary probit model
procrustes_align

Procrustes alignment of latent positions across time
rZ_frn_fc

Draw the latent Z matrix for fixed-rank-nomination data
rZ_frn_bip_fc

Sample Z under bipartite fixed-rank nominations (rectangular)
rZ_cbin_fc

Draw latent Z for censored-binary nomination data
rZ_ord_fc

Full-conditional latent draw for the ordinal family
rZ_cbin_bip_fc

Sample Z under bipartite censored binary nominations (rectangular)
rUV_dynamic_t_fc

Gibbs sampling of dynamic U and V with heavy-tailed (Student-t) innovations
rUV_dynamic_snap_fc_cpp

Update dynamic latent positions with snap-shift model selection
rZ_ord_sym_explicit_fc

Symmetric ordinal Z sample given explicit cutpoints (R >= 0 safe)
rZ_ord_explicit_fc

Sample Z given explicit cutpoints alpha (asymmetric ordinal)
rZ_ord_bip_fc

Sample Z under bipartite ordinal data (rectangular)
rZ_nrm_batch_cpp

Batch normal Z sampling across all time periods
rZ_nrm_fc

Simulate missing values in a normal AME model
rZ_pois_fc

Gibbs update for latent variable in a Poisson AME model
rbeta_ab_bip_gibbs_cpp

Full bipartite Gibbs update for beta, a, b
read_log_lik

Read the per-iteration log-lik matrix back from on-disk chunks
residuals.lame

Extract residuals from LAME model
residuals.ame

Extract residuals from AME model
rZ_ord_sym_fc

Sample Z under symmetric ordinal data (square symmetric matrix)
rbeta_ab_rep_fc

Gibbs update of regression coefficients and additive effects for replicated relational data
rs2_fc

Gibbs update for dyadic variance
rZ_pois_bip_fc

Sample Z under bipartite Poisson (rectangular MH step)
rbeta_ab_fc

Joint Gibbs update of regression and additive effects (single relation)
raSab_bin_fc

Sample additive row effects and their covariance for the binary family
rhat_dynamic_beta

Multivariate split-R-hat for dynamic_beta coefficient paths
rs2_rep_fc

Full-conditional draw of the dyadic variance for replicated relational data
residuals.ame_als

Residuals from a fast AME fit
rmvnorm

Simulation from a multivariate normal distribution
sample_beta_dynamic_cpp

Sample the dynamic-block beta path via FFBS
reconstruct_EZ

Reconstruct EZ and UVPM matrices from AME model output
reexports

Objects exported from other packages
raSab_frn_fc

Simulate a and Sab from full conditional distributions under frn likelihood
rrho_mh

Metropolis-Hastings update for the within-dyad correlation
raSab_cbin_fc

Simulate a and Sab from full conditional distributions under the cbin likelihood
sample_ab_bipartite

Sample additive effects for bipartite networks
sample_beta_static_cpp

Sample the static-block beta conditional on the dynamic path
sample_dynamic_ab_cpp

Sample dynamic additive effects with AR(1) evolution
rtnorm_interval_logp

Exact truncated-normal draw on (lb, ub) via the log.p-scale inverse CDF
rwish

Simulation from a Wishart distribution
sample_alpha_cowles

Cowles MH update for explicit ordinal cutpoints (Z-marginalised)
sample_rho_ab_cpp

Sample AR(1) parameter for dynamic additive effects
sample_rho_beta_cpp

Sample the AR(1) rho for each dynamic block
sample_sigma_ab_cpp

Sample innovation variance for dynamic additive effects
sample_sigma_beta_cpp

Sample the AR(1) innovation sigma for each dynamic block
sample_sigma_G2

Inverse-gamma posterior draw for sigma_G^2 given the FFBS path
sheep

Sheep dominance data
sample_rho_uv

Sample AR(1) parameter for dynamic latent factors
sample_sigma_uv

Sample innovation variance for dynamic latent factors
sampler_describe

Describe the estimator behind a fitted object
simY_pois

Simulate a Poisson relational matrix
simulate.ame

Simulate networks from a fitted AME model
simulate.ame_als

Simulate networks from a fitted ame_als model
snap_category_summary

Summarize snap indices by actor category
sampsonmonks

Sampson's monastery data
simZ

Simulate a latent relational Gaussian array
sm2el

Sociomatrix to edgelist
sample_rho_G_mh

Logit-scale MH update on the AR(1) coefficient rho_G
simY_bin

Simulate a binary relational matrix from latent means
simY_frn

Simulate a relational matrix under a fixed rank nomination scheme
simulate.lame

Simulate longitudinal networks from a fitted LAME model
simulate_posterior

Simulate posterior distributions from fitted AME model
summary.lame.sim

Summary method for LAME simulations
summary.ame.sim

Summary method for AME simulations
snap_index_summary

Summarize posterior snap indices
snap_rank_summary

Summarize posterior rank uncertainty for snap years
snap_index_draws

Extract posterior draws of snap indices
summary.ame

Summary of an AME object
summary.ame_als

Summarize an ame_als object
simY_ord

Simulate an ordinal relational matrix
simY_nrm

Simulate a normal relational matrix
update.ame

Update an AME / LAME fit
tidy.boot_ame

Tidy method for a standalone bootstrap object (boot_ame)
tidy.ame

Tidy method for fitted ame / lame objects
update_variances_bipartite

Update variance parameters for bipartite
tidy

S3 generic for tidy
update.ame_als

Update an ame_als / lame_als fit
vcov.ame_als

Sandwich covariance for the regression coefficients of a fast AME fit
vcov.ame

Posterior covariance of AME model coefficients
trace_plot

MCMC trace plots and density plots for AME/LAME model parameters
summary.lame

Summary of a LAME object
summary.boot_ame

Summarize bootstrap results for a fast AME fit
zscores

rank-based z-scores
waic.ame

WAIC for AME / LAME fits
vcov.boot_ame

Bootstrap covariance of the regression coefficients
vignette_data

TIES sanctions data for vignettes
uv_plot

Visualize multiplicative effects (latent factors) from AME models
tidy.ame_als

Tidy method for fitted ame_als / lame_als objects
Y

Relational matrix
IR90s

International relations in the 90s
Xbeta_bip_cpp

Compute Xbeta product for bipartite networks
Xbeta

Linear combinations of submatrices of an array
ab_plot.ame_als

Additive-effects plot for an ame_als fit
als_start_vals

Convert an ALS fit to MCMC starting values
als_dynamic_beta

Penalised ALS time-varying coefficient estimate
YX_bin

binary relational data and covariates
Xrow

Row covariates
YX_bin_list

Synthetic longitudinal binary relational data, list-form (latent-scale)
addhealthc3

AddHealth community 3 data
Xcol

Column covariates
Xdyad

Dyadic covariates
ab_plot

Visualize sender and receiver random effects
YX_bin_long

synthetic longitudinal binary relational data (latent-scale)
YX_frn

Fixed rank nomination data and covariates
YX_cbin

Censored binary nomination data and covariates
YX_nrm

normal relational data and covariates
addhealthc9

AddHealth community 9 data