Skip to content

Commit d414b70

Browse files
now?
1 parent cf8fa77 commit d414b70

3 files changed

Lines changed: 12 additions & 13 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ vignettes/articles/paper.html
2222
.vscode/settings.json
2323
data-raw/logo_orange.png
2424
data-raw/Landers-Wilson-Garrison Tree.ged
25+
vignettes/understanding_relatedness.Rmd
26+
vignettes/rewritten_relatedness_vignette.Rmd

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Imports:
3737
methods
3838
Suggests:
3939
corrplot,
40+
ggpedigree,
4041
dplyr,
41-
EasyMx,
4242
knitr,
4343
OpenMx,
4444
rmarkdown,

vignettes/analyticrelatedness.Rmd

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -409,8 +409,8 @@ for (i in 1:length(famIDs)) {
409409
410410
411411
# select first ID with a mom and dad
412-
momid_to_cut <- df_fam$ID[!is.na(df_fam$momID)] %>% head(1)
413-
dadid_to_cut <- df_fam$ID[!is.na(df_fam$dadID)] %>% head(1)
412+
momid_to_cut <- head(df_fam$ID[!is.na(df_fam$momID)], 1)
413+
dadid_to_cut <- head(df_fam$ID[!is.na(df_fam$dadID)], 1)
414414
415415
df_fam_dad$dadID[df_fam$ID == dadid_to_cut] <- NA
416416
@@ -561,8 +561,6 @@ corrplot(as.matrix(fam1$ped_add_classic_complete - fam1$ped_add_partial_dad),
561561
These plots show how each method responds to missing data, and whether it maintains consistency with the complete pedigree. We observe that the partial parent method typically introduces smaller deviations. If desired, this same diagnostic can be repeated for additional families, such as inbreeding_list[[2]].
562562

563563

564-
565-
566564
## Summary
567565

568566
Across all families in the inbreeding dataset, the results show a consistent pattern:
@@ -571,8 +569,8 @@ the partial parent method outperforms the classic method in reconstructing the a
571569
To make this explicit, we calculate the RMSE difference between methods. A positive value means that the partial method had lower RMSE (i.e., better accuracy) than the classic method:
572570

573571
```{r}
574-
results <- results %>%
575-
as.data.frame() %>%
572+
results <- results |>
573+
as.data.frame() |>
576574
mutate(
577575
RMSE_diff_dad = RMSE_classic_dad - RMSE_partial_dad,
578576
RMSE_diff_mom = RMSE_classic_mom - RMSE_partial_mom
@@ -583,9 +581,8 @@ We can then summarize the pattern across families:
583581

584582

585583
```{r}
586-
results %>%
587-
select(RMSE_diff_mom, RMSE_diff_dad) %>%
588-
summary()
584+
585+
summary(select(results,RMSE_diff_mom, RMSE_diff_dad))
589586
```
590587

591588
In all families, both `RMSE_diff_mom` and `RMSE_diff_dad` are positive—indicating that the classic method produces larger the errors relative to the partial method. This holds regardless of whether the missing parent is a mother or a father.
@@ -600,12 +597,12 @@ mean(results$RMSE_diff_dad > 0, na.rm = TRUE)
600597
These proportions show how often the partial method produces a lower RMSE across the dataset. This confirms the earlier findings: when pedigree data are incomplete, the partial parent method more faithfully reconstructs the full-data relatedness matrix.
601598

602599
```{r}
603-
results %>%
604-
as.data.frame() %>%
600+
results |>
601+
as.data.frame() |>
605602
select(
606603
-famIDs, -RMSE_diff_mom, -RMSE_diff_dad, -max_R_classic_dad,
607604
-max_R_partial_dad, -max_R_classic_mom, -max_R_partial_mom, -max_R_classic
608-
) %>%
605+
) |>
609606
summary()
610607
```
611608

0 commit comments

Comments
 (0)