Your own study¶
This section describes how to analyse your own data in six steps, from a data file to a report. Each step consists of editing a file or running a command. If you have not run the example study yet, do so first. It takes about ten minutes and shows the structure of a project.
Prerequisites¶
- layerbn is installed and
layerbn --helpworks. - The data are in one table, with one row per participant and one column per variable.
- You have an idea of which variables can influence which. In step 2 this becomes the order of the layers. It is useful to agree on the order with your co-authors beforehand.
Create a project¶
Open a terminal, move to the folder where you store your analyses and create an empty project:
The project folder has this structure:
my-cohort/
├── settings.yml analysis settings → step 4
├── variables.xlsx variables and layers → steps 2 and 3
└── data/ location of the data file → step 1
Keep the terminal in this folder. The commands in step 5 look for settings.yml in the
working folder.
Steps¶
flowchart LR
A["1 · Prepare<br/>the data"] --> B["2 · Order the<br/>variables"]
B --> C["3 · Fill in<br/>variables.xlsx"]
C --> D["4 · Choose the<br/>settings"]
D --> E["5 · Check<br/>and run"]
E --> F["6 · Report"]
E -. "error" .-> C
| Step | Task | Tool | Time |
|---|---|---|---|
| 1 · Prepare the data | Create one table and copy it to data/ |
statistical software | depends on the data |
| 2 · Order the variables | Define the layers and their order | discussion with co-authors | |
| 3 · Fill in variables.xlsx | Add one row per layer and one row per variable | Excel | about 15 minutes |
| 4 · Choose the settings | Enter the name of the data file; other settings are optional | text editor | about 5 minutes |
| 5 · Check and run | Run layerbn check --figure, then layerbn run |
terminal | minutes to an hour |
| 6 · Report | Review the report and describe the analysis | manuscript |
Fixing errors
layerbn check lists any problems, such as a misspelled column name, a layer name that
is spelled differently in two places, or missing values. Correct the files and run the
check again until it reports that the files are valid.
Additional topics¶
The following topics are optional:
- Missing values: model missing values as a separate state, or exclude them.
- Several networks: fit networks with and without certain layers.
- Rules for arcs: forbid or require individual arcs.
- Profiles and sweeps: the probability of the outcome in defined groups.
- Measurements over time: variables measured at several visits.
- The interactive explorer: set evidence and view the updated distributions.
- From Python: run the analysis from a script or notebook.