Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Analysis

The Analysis page runs the analyses most papers need on the datasets you choose: a look at missing data, a correlation table, regressions, a group comparison, a paired comparison, rater agreement, a measurement model, measurement invariance across groups, mediation, a multilevel model and a cross-lagged panel model, each on its own tab beside the Sample, and a Custom tab for any other analysis, scripted with a language model’s help. The tabs use short names (CFA for the measurement model, MLM for the multilevel model, CLPM for the cross-lagged panel), with the full name on hover. Each result is a table ready for a manuscript, with a chart, a Copy table button, Save to outputs, and a Code section with the R and Python code that reproduces it. Where the result has a chart, the code ends by drawing it again, with ggplot2 in R and matplotlib in Python, and saving it as a PNG beside the data; the correlation chart follows the Heatmap or Dots choice. A note under each result says whether it was computed in R or in Python. The correlation table, the regressions, the group comparison and the paired comparison also write a Results paragraph in APA style, with a Copy text button: the significant correlations (each pair when there are three or fewer, otherwise the five strongest), each predictor’s b, SE, p and R², or the means with the test and its effect size. Wording opens the paragraph’s template on the Templates page. Significance is p < .05, and the numbers have the decimal places set on the Settings page. With a language model set up (see Set Up R and Language Models), Interpret with the language model under any Results paragraph, here or on an instrument’s page, asks the model for a short interpretation of the result and a list of things to check. It sends the tables and the paragraph, never any data, and its answer is a draft to check against the tables.

The Analysis page with a correlation table

Sample

The Sample on the left applies to every tab except the multilevel model.

The note below says how many people are in the sample and how they were matched across files: by ID, or by group when stats.correlate_by names one. IDs belong to their study, so files of two studies share no one: with files of several studies, each person’s ID is written with their study first, as pilot/1001C. Rows whose ID repeats within a file are left out. Someone the roster gives no group is matched by their own ID. When a file holds several people of one group (two children of a family), that group is taken person by person, as described under Groups, and the note says how many groups that affects.

Several studies

Choosing datasets of more than one study pools the studies. Each study’s people are matched within that study, as above, and the studies’ people are then put together, one row each. A variable is offered when every chosen study has it in exactly one chosen dataset of a reporter, for example the mood total in wave 1 of one study and in the baseline of another; each person’s value comes from their own study’s file. A score that two reporters give, such as a child’s and a parent’s ratings of the child, is offered once for each, with the reporter after its name. Choose one wave of each study for the variables to pool. The group comparison also offers Study as the groups.

The analyses allow for the study, so that a difference between the studies’ means does not show up as a correlation:

The multilevel model and the cross-lagged panel pick their own waves, and each takes several studies in its own way (see Multilevel model and Cross-lagged panel).

The variable lists hold every score and number item of the chosen measures in the chosen datasets, labeled with their wave. Type in a list to filter it.

Missing data

Choose the Variables; by default, every score of the chosen measures. The first table gives each variable’s n, the number of people without a value, and their percentage, among the people in the Sample. The second lists each pattern of which variables people have (1) and lack (0), with how many people have it, the most common first, as mice::md.pattern shows them. The Results paragraph gives how many people have every variable and the range of missing values.

The correlation table, regression and group comparison each use everyone with values on what they need, and their table notes give the n, unless they are set to multiple imputation.

Multiple imputation

The data of the Sample are imputed once, and every section set to multiple imputation works on that one imputation. Imputed lists what the imputation holds, by default the questionnaires of the chosen datasets: every score made of answer-option items, imputed item by item (with reverse-keyed items reversed) and computed again from its items in each imputed data set, and the demographics’ answer-option items, imputed as categories so that a group comparison can use them. Scores and numbers of other modalities join when chosen. Other scores that help impute adds scores imputed as they are, to carry information into the model (auxiliary variables). Imputed data sets and Seed start from the project’s settings. The imputation runs in R with mice, by predictive mean matching, each column predicted by the columns that correlate at least .10 with it or with its missingness (quickpred).

Run imputes, or reads the imputation already made from the same data and choices, and shows each imputed column’s missing count with its observed and imputed M (SD), and anything mice reported doing, such as leaving out a column that another predicts exactly. Save to outputs under it writes the data, the R script, and imputed.csv: every imputed data set stacked under the observed data, numbered in the .imp column (0 for the data as observed), with each score computed again, for analyses of your own.

Missing values in the Sample panel chooses for the whole page between available cases and multiple imputation; it starts from the project’s setting. With multiple imputation, the correlation table, regression and group comparison use the imputation, the multilevel model imputes its own covariates (see Multilevel model), the panel says how many imputed data sets there are, and Missing data opens this tab; the other tabs say what they use instead (full-information maximum likelihood in the cross-lagged panel and, if chosen, in mediation; the people who answered every item in the measurement model; the data as they are elsewhere). A variable a section needs that the imputation leaves out is named, to add here. The imputation is kept in a file named after the data and the choices, so it is made once and read again by every section, and made again when the Sample, the data or the choices change. A section’s saved R script imputes the same way and keeps the file beside itself.

With multiple imputation, the correlation table gives each variable’s M and SD averaged over the imputed data sets and each correlation pooled with miceadds::micombine.cor (Fisher’s z and Rubin’s rules), for everyone in the Sample. Each regression is fitted in every imputed data set and pooled with mice::pool, with r and its CI from micombine.cor and R² from mice::pool.r.squared; its chart still shows the observed values. The group comparison keeps everyone whose group is known, with the outcome imputed: two groups are compared with Student’s t from the group coefficient of a linear model, pooled with Rubin’s rules, and Cohen’s d pooled with Rubin’s rules (mice::pool.scalar), each imputed data set’s variance of d from its large-sample formula, (n₁ + n₂)/(n₁n₂) + d²/(2(n₁ + n₂)), with a 95% CI at Barnard and Rubin’s df; three or more with the pooled Wald test of the groups (mice::D1) and η² and ω² averaged over them; its chart shows the people whose outcome is observed. With datasets of several studies, each study is imputed by itself; the correlations are then taken within studies in each imputed data set (on the ranks in each data set for Spearman’s ρ) and pooled with micombine.cor, with the p value of the variable’s coefficient in a linear model with the study, pooled with mice::pool, and Correlations in Each Study pools each study’s own correlations; each regression includes the study as a fixed effect in every imputed data set. Mediation, the measurement model and invariance tests do not use the imputation; the factor models use full-information maximum likelihood where their tables say so.

Correlation table

Choose the Variables; by default, every score of the chosen measures, without the number items. The Select menu adds all variables, all of one wave or all of one modality.

The table lists each variable’s n, M and SD and the correlation of every pair, with stars for p < .05, .01 and .001. Each pair uses everyone with both values. The coefficient is the project’s (Pearson’s r, or Spearman’s ρ when stats.correlation is spearman); the switch beside the variables tries the other for this table. With three or more variables, a chart above the table shows the correlations as a Heatmap or as Dots.

Below the Results paragraph, Measures paragraphs give one paragraph for each instrument of the chosen variables in each dataset, as the instrument’s page writes it, with Cronbach’s α from that dataset; Copy text copies them all. McDonald’s ω is on the instrument’s page and the Methods page, which run the factor models. The Regression tab gives the same paragraphs for its outcome and predictors.

Regression

Choose one or more predictors (X) and an outcome (Y). Each predictor gets its own simple regression on everyone with both values. The table gives n, r with its 95% CI, p, the slope and intercept with their standard errors, and R². The chart plots the outcome against each predictor with its fit line, the distributions on the margins and the residuals in an inset. Hover over a point to see the person’s ID.

Group comparison

Choose the Groups, an answer-option item of a demographics instrument (the roster’s items are offered for every chosen file), and the Outcome. Groups with fewer than two people are left out. With two groups, the test is the project’s (Welch’s t test, or Student’s when stats.t_test is student; the switch beside the outcome tries the other), with Cohen’s d and the mean difference, each with a 95% CI. With three or more, it is a one-way ANOVA with η² and ω². The page shows a table of n, M and SD per group, the test table, and a box plot with every person as a point.

Paired comparison

Choose the First and Second measure of the same people, such as a score before and after a task or in two waves. When the first is a score that another chosen dataset also has, that dataset’s score is the second at first. The test is a paired t test on the people with both values (t.test with paired = TRUE), with the mean difference (first minus second) and Cohen’s d of the differences (dz, the mean difference over the SD of the differences, effectsize::cohens_d with paired = TRUE), each with a 95% CI, as JASP’s Paired Samples T-Test gives them with its default options. People are matched across the two datasets as on the rest of the page (stats.correlate_by). The page shows a table of n, M and SD of each measure, the test table, and a chart with each person’s line from the first measure to the second and the means. Multiple imputation does not apply here, and the two measures must come from one study.

Rater agreement

Choose one variable for each rater: the same people rated by two or more coders, each coder’s ratings in a column of their own. When every chosen variable is an item with answer options, the table gives Cohen’s κ for each pair of raters on everyone both rated (a pair who rated fewer than three of the same people gets none), unweighted and with quadratic weights (for ordered options), each with its 95% CI (psych::cohen.kappa), and with three or more raters their average (Light’s κ). Otherwise it gives the six intraclass correlations of Shrout and Fleiss with their 95% CIs, F tests and p values (psych::ICC with its variance components from lme4, as JASP gives them), on everyone with at least one rating; these need R. The Results paragraph reports ICC(2,1) and ICC(2,k), or the κ.

Measurement model

Choose two or more Factors, scores of two or more items each, from any of the chosen datasets; by default, the totals of the first dataset that has two. Each score becomes a factor of its own items and the factors correlate freely, the measurement model a paper reports before a structural model. Scores must not share items, so a total and its subscales cannot be chosen together. Fit runs the model in R with lavaan on the people of the Sample who answered every item, with WLSMV (the items as ordered categories, offered when every item has answer options), ML or MLR; the default is stats.cfa_estimator. A path diagram shows the model as chosen, each factor above its items with the factor correlations as arcs, and after the fit carries the standardized loadings and correlations. The page then shows the fit (χ², CFI, TLI, RMSEA with its 90% CI, SRMR), the standardized loadings with each factor’s ω, and the factor correlations with their 95% CIs, with a Results paragraph. Code holds the R script, and Save to outputs writes it with its data (measurement_data.csv) and the model as an Mplus input. The factor models on the instrument pages fit one instrument in one dataset at a time; this one fits several together, across datasets and reporters, as the Sample pairs them.

Measurement invariance across groups

Choose an Instrument in one of the chosen datasets and the Groups, an answer-option item of a demographics instrument, then press Test. labcatalog fits a multigroup factor model in R with one group per answer and tests configural, threshold (for ordered items), metric and scalar invariance, the same steps as across waves on the instrument page. The grouping item may be in another dataset, such as the child’s gender reported by the parent; people are matched as in the Sample. With datasets of several studies, Study is the first choice of groups (see Several studies). A group needs more people than the model has items, and smaller groups are left out and named. Which items differ and Save and rerun work as on the instrument page, with the freed items stored for this grouping item. Code holds an R script that fits the same steps with lavaan and semTools; Save to outputs writes it with its data (invariance_data.csv) and the Mplus inputs.

Mediation

Choose X, the mediator M and the outcome Y from the scores and numbers of the Sample, and any covariates, which predict both M and Y. A Moderator W is optional; tick the paths it moderates: a (X to M), b (M to Y) or c′ (X to Y, the direct effect). Once W is chosen, a second moderator can be added below it; the two are then W1 and W2, each with the paths it moderates, and their interactions add, with no three-way term (as in Hayes’s PROCESS models 9 and 21). The diagram shows the model as chosen. Fit runs it in R with lavaan. FIML (the default, as in Mplus) keeps everyone with any of the model’s values and estimates by full-information maximum likelihood, with the predictors in the model so that people who lack one stay in; Complete cases keeps only those with all of them. WLSMV, and modsem’s QML for an observed moderator of factors, have no FIML and keep the complete cases, as a note under the diagram says; with a moderator, X, M and W are centred at their means and the conditional effects are taken at W’s two answers or at its mean and 1 SD either side; with two, at every combination of the values of the moderators an effect varies with (nine rows for two moderators of a or b). The table gives each path, the indirect effect (a × b) and, without a moderator, the total effect; with a moderator, the conditional indirect and direct effects and, when only a or only b is moderated, the index of moderated mediation. With two moderators, each that moderates only a, or only b while nothing moderates the other, has an index of partial moderated mediation; one on a and the other on b leave no single index. With Bootstrap, confidence intervals are percentile bootstrap intervals; set the number of Bootstrap resamples (1000 by default). With None, they are Wald intervals (by the delta method for the indirect and other defined effects), which take seconds. ML or MLR sets the estimator: bootstrapping needs plain maximum likelihood, whose estimates are the same as MLR’s, so with Bootstrap MLR changes only the fit test; with None, MLR also gives robust standard errors. Scores or Items sets what the variables are. With Scores, X, M, Y and W are the scores themselves. With Items, X, M and Y must be scores with two or more items, and each becomes a factor of its items (the first item’s loading fixed at 1); a moderator that is a score becomes a factor too, and one that is a number or an answer stays observed. Their items must not overlap, so a total and one of its subscales cannot both be factors. Without a moderator the item model runs in lavaan and offers WLSMV, which treats the items as ordered categories (its bootstrap refits by DWLS, whose estimates are WLSMV’s). With a moderator it runs in modsem, which fits the latent interaction by LMS, or by QML when the moderator is observed, with the items as continuous; there is then no chi-square test of fit, and each bootstrap resample refits the whole model, so 1000 resamples take several minutes. The table’s β column is fully standardized; effects taken at values of W have none. The Results paragraph reports the numbers, and Code holds the R script, which Save to outputs writes with the data. Save to outputs also writes the model as an Mplus input (mplus_mediation.inp) with its data, centred as in R, and with the path to Mplus set on the Settings page, Run in Mplus runs it. Mplus bootstraps with ML only, so with MLR its input uses ML, whose estimates are the same; it cannot bootstrap a latent interaction (XWITH with numerical integration), so there its intervals are by the delta method. Mediation needs R, and the Items mode with a moderator needs the R package modsem; the number of R processes for the resamples is on the Settings page.

Multilevel model

A linear mixed model of one outcome across waves. This section picks its own waves and keeps everyone with at least one; the Sample does not apply, except for Measures.

Waves of several studies pool them. IDs belong to their study, so each study’s people and groups are their own; time counts from each study’s first chosen wave (or its earliest visit date), and the study enters as a fixed effect, compared with the first study. Each study needs what one study needs, such as two or more waves for people as a level. A covariate from one dataset then pairs one dataset of each study, named in the list, such as parent_w1 + s2_parent_baseline: each study’s first dataset that has it, then each study’s second, and so on. Each person’s value comes from their own study’s dataset. On the chart, waves at the same place in each study share a name, such as 1/baseline.

The results are three tables: Fixed Effects (b, SE, df, t, p and 95% CI; with Satterthwaite’s df in R), Random Effects (variances, SDs and the slope-intercept correlation) and Model Summary (the ICC of each level, the numbers of observations, people and groups, and fit statistics). With occasions, three tables come first: Tests of the Occasions (type III F tests with Satterthwaite’s df, anova of lmerTest, or Wald χ² tests in Python), Estimated Marginal Means (each combination’s mean, SE and 95% CI, emmeans, with numbers in the model at their mean and answer options weighted equally) and Comparisons of the Occasions (the levels of the first factor compared within each level of the others, with p adjusted by Holm’s method); the fixed effects then name each level’s difference from the mean of its factor’s levels. A warning appears when the fit is singular, that is, when a random effect cannot be estimated from these data; a simpler model, such as one without the random slope, may then fit.

The model keeps every wave a person has, so a missing outcome leaves out only that wave. A row missing a covariate is left out, unless Missing values is set to multiple imputation: the covariates are then imputed in R with mice (predictive mean matching, answer options as categories), with the number of imputed data sets and the seed of the Missing data tab. Each person is one row with each wave’s values side by side, so their outcomes and other waves predict what is missing; people of one group are imputed as if apart, and several studies each by themselves. Outcomes stay missing where they were. Split covariates are imputed as measured and split again in each imputed data set. The model is fitted in each one and the fixed effects pooled with Rubin’s rules (mitml::testEstimates), with Barnard and Rubin’s df from each term’s Satterthwaite df; the ICCs, variances and correlations are averaged over the imputed data sets, and the fit statistics are left out. When no covariate is missing where the outcome is, nothing is imputed.

Under them, a Results paragraph with a Copy text button gives the model’s design and sample, the ICC, each fixed effect and the SD of each random effect. With occasions, the paragraph gives the tests and the comparisons in place of the fixed effects, and the chart draws each occasion’s estimated marginal mean with its 95% CI, a line for each level of the other factors. Otherwise, below that, a chart of the trajectories draws each person’s values across the waves as thin lines, each wave’s mean as a circle, and the fixed effects’ prediction (intercept plus time) as a thick line. With time from the dates, the axis counts months or years. With covariates in the model, the line is the prediction for the mean of each number covariate and the reference option of each answer covariate. With multiple imputation, the chart draws the rows with every value observed and the line from the pooled fixed effects.

Save to outputs writes the tables, the chart, the R and Python code, and multilevel_data.csv, with one row per person and wave.

Cross-lagged panel

Choose X and Y, two scores or numbers each measured at three or more waves of one study; the waves both have are used, one dataset per wave from the first one’s reporter, and people in different datasets are matched as everywhere on the page. Like the multilevel model, this tab keeps everyone with a value and the Sample does not apply. Fit fits three models in R with lavaan, by robust maximum likelihood (MLR) with full-information maximum likelihood for missing values: the random intercept cross-lagged panel model (RI-CLPM) of Hamaker, Kuiper and Grasman (2015), as Mulder and Hamaker (2021) write it, with each lagged path free; the same with each kind of lagged path held equal across waves; and the cross-lagged panel model without random intercepts (CLPM).

The diagram shows X above Y, a column per wave, with the random intercepts loading on each row and the standardized lagged paths. The tables give the three models’ fit with the scaled chi-square difference tests between them (equal paths against free, and the CLPM against the RI-CLPM, a test at the boundary whose p is conservative), the standardized lagged effects of each model at each transition, and the correlation of the random intercepts (between people) and of X and Y at each wave (within people). The Results paragraph reports the paths from the equal model when holding them equal does not worsen fit, and from the free model otherwise. Save to outputs writes the data, the R script, and the three models as Mplus inputs with their data.

When two or more studies measure both X and Y at three or more of the same waves, Studies chooses which to fit; by default, the first. With several chosen, each must share as many waves, and their first waves are put side by side, then their second, named like 1/baseline. IDs belong to their study, so each study’s people are their own. Each study is a group of one multigroup model (lavaan’s group), with its own means, variances and paths, and two more models hold the lagged paths equal across the studies: free across waves, and equal across waves. Their scaled chi-square difference tests say whether the paths differ between the studies. The paths are reported from the model chosen across waves as above, held equal across the studies when that does not worsen fit. The tables give each study’s paths and correlations, the diagram the first study’s, and the Mplus inputs group by study, with each study’s own intercepts.

Custom

For an analysis the other tabs do not offer. Choose the Variables, say in The analysis what you want, pick R, Python or Mplus and click Draft: the language model set on the Settings page writes a script, which appears in the editor with anything it could not settle listed under To check. Draft sends what you wrote with the chosen columns’ names, labels, answer options and how many people have a value, never the data; paste a few rows into the box yourself if the model needs to see them. Without a language model, write the script in the editor yourself.

The script reads analysis_data.csv from its own folder: one row per person of the Sample, the chosen variables, and each chosen score’s items, reversed where the scale says so. Run runs it on this computer, R scripts with the Rscript set on the Settings page and in turn with the page’s other R analyses, Python scripts with the Python set on the Settings page, or labcatalog’s own when it was installed with pip; Stop ends it. What it prints appears under Output, with the figures it saves as .png and the tables it saves as .csv. When it stops with an error and a language model is set, Ask the model to fix it sends the script and its output and shows the changes it proposes; Use it puts them in the editor. Save to outputs writes the data, the script, its output and every file it wrote. The script reads the data as they are, without multiple imputation.

Mplus is for models with latent variables or structural equations: factor models, structural equation and path models, multigroup and multilevel structural equation models, growth models, latent class and mixture models. For anything else the model writes nothing and suggests R or Python. labcatalog writes the start of the input itself: the title, a comment line giving each column’s short Mplus name (at most eight characters), DATA: FILE = analysis_data.dat;, the names and the missing value code. The data file has no header, numbers each ID, and writes missing values as -999. The model writes the rest of the input. Run needs the path to Mplus on the Settings page, and shows the .out file.

Keep in project saves the script in the project’s analyses folder, under a name of lower-case letters, digits and _, and lists it under analyses in labcatalog.yaml with the datasets, the Sample’s switch, the variables and what you asked for. Kept analyses appear at the top of the tab under Saved: a click opens one, setting the Sample and the variables as they were, ready to run again on the data as they are now; the code button beside it opens its script on the Scripts page, and the cross removes it and its script. Keeping one under a name already kept replaces it.

Saved files

Every Save to outputs on this page writes a new folder in outputs/ with the tables as .csv, .docx and .tex, the chart as .png and .svg, the data and the R and Python scripts, and manifest.json. See Copy Tables into a Manuscript.