dfa_loadings {bayesdfa}R Documentation

Get the loadings from a DFA as a data frame

Description

Get the loadings from a DFA as a data frame

Usage

dfa_loadings(rotated_modelfit, names = NULL, summary = TRUE, conf_level = 0.95)

Arguments

rotated_modelfit

Output from rotate_trends.

names

An optional vector of names for plotting the loadings.

summary

Logical. Should the full posterior densities be returned? Defaults to TRUE.

conf_level

Confidence level for credible intervals. Defaults to 0.95.

Value

A data frame with the following columns: name is an identifier for each loading, trend is the trend for the loading, median is the posterior median loading, lower is the lower CI, upper is the upper CI, and prob_diff0 is the probability the loading is different than 0. When summary = FALSE, there is no lower or upper columns and instead there are columns chain and draw.

See Also

plot_loadings fit_dfa rotate_trends

Examples

set.seed(42)
s <- sim_dfa(num_trends = 2, num_ts = 4, num_years = 10)
# only 1 chain and 180 iterations used so example runs quickly:
m <- fit_dfa(y = s$y_sim, num_trends = 2, iter = 50, chains = 1)
r <- rotate_trends(m)
loadings <- dfa_loadings(r, summary = TRUE)
loadings <- dfa_loadings(r, summary = FALSE)

[Package bayesdfa version 1.1.0 Index]