-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathREADME.Rmd
More file actions
211 lines (159 loc) · 10.9 KB
/
README.Rmd
File metadata and controls
211 lines (159 loc) · 10.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# discord
<!-- badges: start -->
<a href="https://r-computing-lab.github.io/discord/"><img src="man/figures/logo.png" alt="discord website" align="right" height="139"/></a>
[](https://www.repostatus.org/#active)
[](https://cran.r-project.org/package=discord)
[](https://cran.r-project.org/package=discord)</br>
[](https://github.com/R-Computing-Lab/discord/actions/workflows/R-CMD-check.yaml)
[](https://github.com/R-Computing-Lab/discord/actions/workflows/R-CMD-dev_check.yaml)
[](https://app.codecov.io/gh/R-Computing-Lab/discord)
[](https://www.codefactor.io/repository/github/r-computing-lab/discord)

<!-- badges: end -->
`discord` is an R package that provides functions for discordant kinship
modeling and other sibling-based quasi-experimental designs. It includes
functions for data preparation, regression analysis, and simulation of
genetically-informed data. The package is designed to facilitate the
implementation of discordant sibling designs in research, allowing for
the control of shared familial confounding factors.
Visit the [discord website](https://r-computing-lab.github.io/discord/)
for more information and detailed documentation. Below is a brief
overview of the package, its features, and a roadmap to get you started.
## Quick Start Guide
### Step 1: Install the Package
```r
# Install from CRAN
install.packages('discord')
# Or install development version from GitHub
# install.packages('devtools')
devtools::install_github('R-Computing-Lab/discord')
```
### Step 2: Choose Your Starting Point
Your workflow depends on your data structure and experience level:
**🚀 New to discordant-kinship regression?**
- Start with [Full Data Workflow](https://r-computing-lab.github.io/discord/articles/full_data_workflow.html)
- Demonstrates complete end-to-end example for beginners
- Transforms data from wide, long, or pedigree formats
- Selects siblings for OLS and orders for discordant analysis
- Shows all three models (OLS, Between-Family, Discordant) side-by-side
- Includes equations, manually specified syntax, as well as function calls
**📊 Have NLSY data or existing kinship links?**
- Use [NLSY Regression Analysis](https://r-computing-lab.github.io/discord/articles/regression.html)
- Real-world example with flu vaccination and SES data
- Complete workflow from kinship linking to interpretation
**🔧 Need to build kinship links from scratch?**
- See [Using discord with Simple Family Structures](https://r-computing-lab.github.io/discord/articles/links.html)
- Construct links from basic family IDs (mother, father)
- Works without pre-existing kinship databases
### Step 3: Explore Advanced Topics
Once you understand the basics, explore specialized topics:
- **Categorical predictors**: [Categorical Predictors Vignette](https://r-computing-lab.github.io/discord/articles/categorical_predictors.html)
- **Visualizing results**: [Plotting Vignette](https://r-computing-lab.github.io/discord/articles/plots.html)
- **Sample size planning**: [Power Analysis Vignette](https://r-computing-lab.github.io/discord/articles/Power.html)
## Package Features
- **Data Preparation**: Functions to prepare and structure data for
discordant sibling analysis, including handling of kinship pairs and
demographic variables.
- **Regression Analysis**: Tools to perform discordant regression
analyses, allowing for the examination of within-family effects
while controlling for shared familial confounders.
- **Simulation**: Functions to simulate genetically-informed data,
enabling researchers to test and validate their models.
## Complete Vignette Roadmap
The package includes several vignettes organized by user needs. All vignettes can be accessed [online](https://r-computing-lab.github.io/discord/articles/) or from the RStudio "Vignettes" tab after package installation.
### 📚 Start Here: Core Workflows
These vignettes provide complete end-to-end examples and should be your first stop:
- [Full data workflow for discord](https://r-computing-lab.github.io/discord/articles/full_data_workflow.html)
- **What you'll learn:**
- How to transform data from wide, long, or pedigree formats
- How to select siblings for standard OLS regression
- How to discord orders siblings for discordant-kinship analysis
- How to run and compare all three model types (OLS, Between-Family, Discordant)
- including specify models using equations, manual syntax, and function calls
- How to interpret difference scores and mean scores
- Complete side-by-side model comparisons
- [NLSY regression analysis with discord](https://r-computing-lab.github.io/discord/articles/regression.html)
- Use this vignette if you want an end-to-end applied example that links NLSY79 relatives, cleans variables for flu vaccination and SES, constructs dyads, and then fits within-family models.
- You will learn how to specify discord_regression correctly and interpret coefficients.
### 🔧 Data Preparation
- [No Database? No Problem: Using discord with simple family Structures](https://r-computing-lab.github.io/discord/articles/links.html)
- This vignette is particularly useful for situations when you do not have existing kinship links and need to build relationships directly from simple family identifiers.
- It shows how to construct the links, optionally simulate phenotypes under specified structures, and fit discord_regression with alternative specifications for small or bespoke datasets.
### 📊 Advanced Topics
- [Creating plots for discord](https://r-computing-lab.github.io/discord/articles/plots.html)
- This vignette takes fitted discord_regression outputs and
produces publication-ready ggplot figures of effect estimates and within-family contrasts with minimal transformation of the model results.
- It includes complete plotting code paths you can reuse, from extracting estimates to saving figures that clearly communicate within-family findings.
- [Power Analysis with discord](https://r-computing-lab.github.io/discord/articles/power.html)
- Use this vignette when you need to plan sample sizes or evaluate power by running simulation grids that vary effect sizes, kin types, and Ns using kinsim, then re-fitting discord_regression under each condition. It reports empirical power and writes tidy summaries.
- [Handling categorical predictors with discord](https://r-computing-lab.github.io/discord/articles/categorical_predictors.html)
- This vignette formalizes categorical predictors in discord
designs by separating categorical variables into within-dyad and between-dyad components. It makes the implied contrasts explicit.
- It discusses the pitfalls of interpreting coefficients when using categorical predictors, and reviews best practices for coding and interpretation.
## External Reproducible Examples
Beyond the vignettes, you can find additional examples that fully
reproduce analyses from our other publications (Garrison et al 2025,
etc). These examples can be accessed via the following links and
are presented in reverse chronological order:
- National Longitudinal Survey of Youth (NLSY) datasets
- [NLSY AMPPS repo](https://github.com/R-Computing-Lab/target-causalclaims): Reproduces NLSY analyses from Garrison et al 2025, using `targets` for workflow management. Garrison, S. M., Trattner, J. D., Lyu,
X., Prillaman, H. R., McKinzie, L., Thompson, S. H. E., &
Rodgers, J. L. (2025). Sibling Models Can Test Causal Claims
without Experiments: Applications for Psychology.
<https://doi.org/10.1101/2025.08.25.25334395>
- [Frontiers repo](https://github.com/R-Computing-Lab/Sims-et-al-2024):
Reproduces Sims, E. E., Trattner, J. D., & Garrison, S. M.
(2024). Exploring the relationship between depression and
delinquency: a sibling comparison design using the NLSY.
Frontiers in psychology, 15, 1430978.
<https://doi.org/10.3389/fpsyg.2024.1430978>
- [Intelligence repo](https://github.com/R-Computing-Lab/Project_AFI_Intelligence):
Reproduces Garrison, S. M., & Rodgers, J. L. (2016). Casting
doubt on the causal link between intelligence and age at first
intercourse: A cross-generational sibling comparison design
using the NLSY. Intelligence, 59, 139-156.
<https://doi.org/10.1016/j.intell.2016.08.008>
- China Family Panel Studies (CFPS) dataset
- [CFPS AMPPS repo](https://github.com/R-Computing-Lab/discord_CFPS):
Reproduces analyses from the China Family Panel Studies (CFPS)
dataset, focusing on the association between adolescent
depression and math achievement. Garrison, S. M., Trattner, J. D., Lyu,
X., Prillaman, H. R., McKinzie, L., Thompson, S. H. E., &
Rodgers, J. L. (2025). Sibling Models Can Test Causal Claims
without Experiments: Applications for Psychology.
<https://doi.org/10.1101/2025.08.25.25334395>
## Citation
If you use `discord` in your research or wish to refer to it, please cite the following package as well as the AMPPS paper:
```{r echo=FALSE, message=FALSE, warning=FALSE, comment=NA}
cite <- citation(package = "discord")
if (length(cite$year) == 0 || is.na(cite$year)) {
cite$year <- format(Sys.Date(), "%Y")
}
if (length(cite$doi) == 0 || is.na(cite$doi)) {
cite$doi <- "10.32614/CRAN.package.discord"
}
print(cite)
```
## Contributing
Contributions to the `discord` project are welcome. For guidelines on
how to contribute, please refer to the [Contributing
Guidelines](https://github.com/R-Computing-Lab/discord/blob/main/CONTRIBUTING.md).
Issues and pull requests should be submitted on the GitHub repository.
For support, please use the GitHub issues page.
## License
`discord` is licensed under the GNU General Public License v3.0. For
more details, see the
[LICENSE](https://github.com/R-Computing-Lab/discord/blob/main/LICENSE)
file.