Skip to contents

Multilevel helpers

Explore multilevel data: lmer helpers, centering, exploring parameters

add_term()
Add or remove terms to a lmer formula string
cor_between()
Correlation between group aggregates
cor_within()
Within-group correlations
explained_variance()
Computes pseudo-R2 by subtracting residual variances
grand_center()
Grand mean centering of one or more variables
group_center()
Group-centering of one or more variables
aggr_and_merge()
Creates country level variables by aggregating individual level variables
potential_interactions()
Potential cross-level interactions
potential_interactions_ind()
Potential individual-level interactions for lmer model
search_random()
Find random effects across fixed
vif_mer()
Compute variance inflation factor for mer objects

SEM helpers

Handy SEM helpers

add_all_indir_and_tot()
Add all possible indirect and total effects to the `lavaan` formula
check_mplus_model()
Check NDP related to residuals and correlations of models read by 'readModels'
diff_test_mlr()
Loglikelihood test for MLR estimator
diff_test_mlr_manual()
Loglikelihood test for MLR estimator - wrapper
each_param_psr_mplus()
Various versions of PSR
extract_mlefa()
Extracts fit indices of the Multilevel EFA (Mplus output)
gamma_hat_mplus()
Computes Gamma fit index for SEM models fit in Mplus
get_params_mplus()
Extracts parameters from Bayesian models produces by Mplus where 'readModels' cannot help
get_psr()
get PSR from an mplus output file
lav_compare()
Combine fit measures form several models and compare
manipulate_mplus()
manipulate mplus file
partable_mplus()
Summarize parameters from several Mplus models read by 'readModels'
sem_tab()
SEM tab
tech11_14()
Extracts Tech11 and Tech14 (Tests for mixture models)
brmsea()
Hoot's BRMSEA

Tools for labelled data and Rstudio viewer

Formatting, showing results, and handling labels

label_book()
Create a codebook, table of labels to explore variables and values in your data
drop_labs()
Get rid of the labels
label_table()
Alias for label_book
lab_to_fac()
Convert labelled variable to a factor with corresponding values
unhaven()
Drop the structure added by haven package
untibble()
Get rid of the tibble
eststar()
Quickly generate string from estimates and p-values
f()
Format the number quickly and remove zero before dot
sig_to_bold()
Conditional formatting
pvalue_to_stars()
Convert numbers to stars
df_to_viewer()
Shows data.frame or model(s) in RStudio viewer
lmer_table()
Function producing a tidy table for many multilevel regressions (lmer fitted objects)

Plots and diagrams

Visualize multilevel and SEM

graph_means_ci()
Graph means w/CIs
lav_to_graph()
Create a Graphviz path diagram using lavaan syntax
lav_to_draw()
Convert lavaan to draw.io diagram
plef()
Simple interaction plot with nice defaults
plot_latent_means()
Plot latent means
random_interaction()
Plot cross-level interactions for mer objects
random_plot()
Plot random effects and interactions for lmer objects
scatter_means_ci()
Computes means by group and plots them in as a scatterplot
sig_seg()
Prepares data for significance staples on ggplot
stacked_bar()
Quick stacked bar plot
theme_mr()
Clean and precise theme
traceplots_mplus()
Extract and export Mplus trace and autocorrelation plots into pdf

Miscellaneous

Convenience functions and shortcuts

cor_table()
Correlation table with stars
compare_cor()
Compare two correlation matrices
crosstab()
Easy cross-tabulation with labels
match_named_vectors()
Match named vectors to a data.frame
replace_by_table()
Replace by table
reverse()
Reverse values and value labels
mean_se_lower_upper()
Means and SEs
se()
Standard err of mean
get_net()
Make a quick network graph
na_tab()
Prints the number and percent of NAs in a dataframe
verb()
Convenience function for logging the code
ess_values()
Compute basic values indices as measured in European Social Survey
values
List of Schwartz values