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 group-level variables by aggregating individual-level variables and adding it to the df
lmer_table()
Create Regression Table for Multilevel Models
potential_interactions()
Potential cross-level interactions
potential_interactions_ind()
Potential individual-level interactions for lmer model
search_random()
Find which random effects could be added to a lmer model
vif_mer()
Compute variance inflation factor for mer objects

Mplus helpers

Extract info from Mplus output, beyond MplusAutomation package

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
manipulate_mplus()
Manipulate mplus file
partable_mplus()
Summarize parameters from several Mplus models read by 'readModels'
tech11_14()
Extracts Tech11 and Tech14 (Tests for mixture models)

lavaan helpers

add_all_indir_and_tot()
Add all possible indirect and total effects to the `lavaan` formula
lav_compare()
Combine fit measures form several models and compare
sem_tab()
Table with parameters from a lavaan model

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
df_to_viewer()
Shows data.frame or model(s) in RStudio viewer
drop_labs()
Get rid of the labels
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()
Format Estimates with Significance Stars and Optional Confidence Intervals
f()
Format the number quickly and remove zero before dot
sig_to_bold()
Conditional formatting
pvalue_to_stars()
Convert P-values to Significance Stars

Plots and diagrams

Visualize multilevel models 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
fill_tri()
Make a matrix full form lower or upper triangle
match_named_vectors()
Combine Named Vectors into Data Frame by Matching Names
replace_by_table()
Replace by table
reverse()
Reverse values and value labels
mean_se_lower_upper()
Means and SEs
se()
Standard Error 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