Content-Length: 262143 | pFad | http://github.com/PBCAR/Visualizations/commit/#start-of-content

6796DFD3 Addition of basic spaghetti plots · PBCAR/Visualizations@08411fd · GitHub
Skip to content

Commit

Permalink
Addition of basic spaghetti plots
Browse files Browse the repository at this point in the history
  • Loading branch information
kbelisar authored Sep 9, 2024
1 parent 5e3d750 commit 08411fd
Show file tree
Hide file tree
Showing 5 changed files with 607 additions and 502 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

A repository of scripts that can be used to reproduce some of the individual-level data visualization techniques that are popular at PBCAR. The corresponding example figures were created from the scripts themselves, making it easy to see what parts of the code correspond to the produced visualization.

These scripts accompany a small mock data set in wide format. The data set consists of 500 hypothetical participants whose data were collected at baseline, with follow-up data available for cannabis and alcohol outcomes. The variables are as follows:
These scripts accompany a small mock data set in wide format. The data set consists of 500 hypothetical participants whose data were collected at baseline, with follow-up (t2) data available for cannabis and alcohol outcomes, and 3 additional follow-up time points (t3-t5) for total drinks per week. The variables are as follows:

| Variable | Definition |
|---------------|-----------------------------------------------------------------------------------------------------------------------|
Expand All @@ -17,6 +17,9 @@ These scripts accompany a small mock data set in wide format. The data set consi
| drink_days2 | Typical number of drinking days per week at follow-up (t2) |
| total_drinks1 | Number of drinks consumed on average per week at baseline (t1) |
| total_drinks2 | Number of drinks consumed on average per week at follow-up (t2) |
| total_drinks3 | Number of drinks consumed on average per week at follow-up (t3) |
| total_drinks4 | Number of drinks consumed on average per week at follow-up (t4) |
| total_drinks5 | Number of drinks consumed on average per week at follow-up (t5) |
| perception1 | Perception of regular medicinal cannabis use from 1 = 'Not at all Acceptable' to 5 = Completely Acceptable |
| perception2 | Perception of regular recreational cannabis use from 1 = 'Not at all Acceptable' to 5 = 'Completely Acceptable' |
| perception3 | Perception of regular alcohol use from 1 = 'Not at all Acceptable' to 5 = 'Completely Acceptable' |
Expand Down Expand Up @@ -110,6 +113,22 @@ The second example layers the lasagna plot by the cannabis frequency variable at

This script also uses the [dplyr](https://github.com/tidyverse/dplyr) package.

## Spaghetti Plots

Keeping with the pasta theme, spaghetti plots are a way to visualize the trajectories of all participants to identify overall trends in the data but also see how closely individuals follow this trend. The spaghetti plot script ([spaghetti.R](https://github.com/PBCAR/Visualizations/blob/main/scripts/spaghetti.R)) in this repository provide an example of each grouping type.

The first example shows spaghetti plots created by a grouping variable.

![](examples/spaghetti_example1.png)

The second example layers an overall mean trajectory by the grouping variable.

![](examples/spaghetti_example2.png)

### Packages:

This script also uses the [dplyr](https://github.com/tidyverse/dplyr) package.

## Corset Plots

Corset plots are used to show the heterogeneity of change in repeat measures data at 2 time points. They can be made using the [ggcorset](https://github.com/kbelisar/ggcorset) package. To use this package, please refer to the downloading instructions and detailed examples provided with the package. Alternatively, an example has been provided with the mock data set:
Expand Down
Loading

0 comments on commit 08411fd

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/PBCAR/Visualizations/commit/#start-of-content

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy