Date: Fri, 23 Jan 2026 17:37:14 -0500
Subject: [PATCH 06/27] DOC
---
man/adjustKidsPerCouple.Rd | 2 +-
man/assignCoupleIDs.Rd | 2 +-
man/buildBetweenGenerations.Rd | 3 +-
man/buildWithinGenerations.Rd | 1 +
man/createGenDataFrame.Rd | 2 +-
man/determineSex.Rd | 2 +-
man/markPotentialChildren.Rd | 2 +-
man/ped2add.Rd | 4 +-
man/ped2cn.Rd | 4 +-
man/ped2com.Rd | 4 +-
man/ped2gen.Rd | 4 +-
man/ped2mit.Rd | 4 +-
man/simulatePedigree.Rd | 3 +-
vignettes/v1_modelingvariancecomponents.html | 197 ++++++++-------
vignettes/v2_pedigree.html | 49 ++--
vignettes/v4_validation.html | 239 ++++++++++++-------
16 files changed, 283 insertions(+), 239 deletions(-)
diff --git a/man/adjustKidsPerCouple.Rd b/man/adjustKidsPerCouple.Rd
index a3019c45..d840a625 100644
--- a/man/adjustKidsPerCouple.Rd
+++ b/man/adjustKidsPerCouple.Rd
@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/helpPedigree.R
+% Please edit documentation in R/helpSimulatePedigree.R
\name{adjustKidsPerCouple}
\alias{adjustKidsPerCouple}
\title{Generate or Adjust Number of Kids per Couple Based on Mating Rate}
diff --git a/man/assignCoupleIDs.Rd b/man/assignCoupleIDs.Rd
index d1de671e..22094029 100644
--- a/man/assignCoupleIDs.Rd
+++ b/man/assignCoupleIDs.Rd
@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/helpPedigree.R
+% Please edit documentation in R/helpSimulatePedigree.R
\name{assignCoupleIDs}
\alias{assignCoupleIDs}
\alias{assignCoupleIds}
diff --git a/man/buildBetweenGenerations.Rd b/man/buildBetweenGenerations.Rd
index 4e297579..cb0c6232 100644
--- a/man/buildBetweenGenerations.Rd
+++ b/man/buildBetweenGenerations.Rd
@@ -17,7 +17,8 @@ buildBetweenGenerations(
momID = "momID",
dadID = "dadID",
code_male = "M",
- code_female = "F"
+ code_female = "F",
+ beta = FALSE
)
}
\arguments{
diff --git a/man/buildWithinGenerations.Rd b/man/buildWithinGenerations.Rd
index 157faed6..93508575 100644
--- a/man/buildWithinGenerations.Rd
+++ b/man/buildWithinGenerations.Rd
@@ -5,6 +5,7 @@
\title{Process Generations for Pedigree Simulation}
\usage{
buildWithinGenerations(
+ beta = FALSE,
sizeGens,
marR,
sexR,
diff --git a/man/createGenDataFrame.Rd b/man/createGenDataFrame.Rd
index 014ee86c..ce14ffe6 100644
--- a/man/createGenDataFrame.Rd
+++ b/man/createGenDataFrame.Rd
@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/helpPedigree.R
+% Please edit documentation in R/helpSimulatePedigree.R
\name{createGenDataFrame}
\alias{createGenDataFrame}
\title{Create Data Frame for Generation}
diff --git a/man/determineSex.Rd b/man/determineSex.Rd
index 39711ada..b56bb59d 100644
--- a/man/determineSex.Rd
+++ b/man/determineSex.Rd
@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/helpPedigree.R
+% Please edit documentation in R/helpSimulatePedigree.R
\name{determineSex}
\alias{determineSex}
\title{Determine Sex of Offspring}
diff --git a/man/markPotentialChildren.Rd b/man/markPotentialChildren.Rd
index a51e496c..e63721fd 100644
--- a/man/markPotentialChildren.Rd
+++ b/man/markPotentialChildren.Rd
@@ -1,5 +1,5 @@
% Generated by roxygen2: do not edit by hand
-% Please edit documentation in R/helpPedigree.R
+% Please edit documentation in R/helpSimulatePedigree.R
\name{markPotentialChildren}
\alias{markPotentialChildren}
\title{Mark and Assign children}
diff --git a/man/ped2add.Rd b/man/ped2add.Rd
index e26c100e..dc2fee88 100644
--- a/man/ped2add.Rd
+++ b/man/ped2add.Rd
@@ -27,9 +27,7 @@ ped2add(
\arguments{
\item{ped}{a pedigree dataset. Needs ID, momID, and dadID columns}
-\item{max_gen}{the maximum number of generations to compute
-(e.g., only up to 4th degree relatives). The default is 25. However it can be set to infinity.
- `Inf` uses as many generations as there are in the data.}
+\item{max_gen}{the maximum number of iterations that the adjacency matrix is multiplied to get the relatedness matrix. `Inf` uses as many iterations as there are in the data. Defaults to 25.}
\item{sparse}{logical. If TRUE, use and return sparse matrices from Matrix package}
diff --git a/man/ped2cn.Rd b/man/ped2cn.Rd
index 69062b07..aafa5f7e 100644
--- a/man/ped2cn.Rd
+++ b/man/ped2cn.Rd
@@ -27,9 +27,7 @@ ped2cn(
\arguments{
\item{ped}{a pedigree dataset. Needs ID, momID, and dadID columns}
-\item{max_gen}{the maximum number of generations to compute
-(e.g., only up to 4th degree relatives). The default is 25. However it can be set to infinity.
- `Inf` uses as many generations as there are in the data.}
+\item{max_gen}{the maximum number of iterations that the adjacency matrix is multiplied to get the relatedness matrix. `Inf` uses as many iterations as there are in the data. Defaults to 25.}
\item{sparse}{logical. If TRUE, use and return sparse matrices from Matrix package}
diff --git a/man/ped2com.Rd b/man/ped2com.Rd
index c69574d6..f34d6022 100644
--- a/man/ped2com.Rd
+++ b/man/ped2com.Rd
@@ -33,9 +33,7 @@ ped2com(
\item{component}{character. Which component of the pedigree to return. See Details.}
-\item{max_gen}{the maximum number of generations to compute
-(e.g., only up to 4th degree relatives). The default is 25. However it can be set to infinity.
- `Inf` uses as many generations as there are in the data.}
+\item{max_gen}{the maximum number of iterations that the adjacency matrix is multiplied to get the relatedness matrix. `Inf` uses as many iterations as there are in the data. Defaults to 25.}
\item{sparse}{logical. If TRUE, use and return sparse matrices from Matrix package}
diff --git a/man/ped2gen.Rd b/man/ped2gen.Rd
index cda9f589..d57facbf 100644
--- a/man/ped2gen.Rd
+++ b/man/ped2gen.Rd
@@ -27,9 +27,7 @@ ped2gen(
\arguments{
\item{ped}{a pedigree dataset. Needs ID, momID, and dadID columns}
-\item{max_gen}{the maximum number of generations to compute
-(e.g., only up to 4th degree relatives). The default is 25. However it can be set to infinity.
- `Inf` uses as many generations as there are in the data.}
+\item{max_gen}{the maximum number of iterations that the adjacency matrix is multiplied to get the relatedness matrix. `Inf` uses as many iterations as there are in the data. Defaults to 25.}
\item{sparse}{logical. If TRUE, use and return sparse matrices from Matrix package}
diff --git a/man/ped2mit.Rd b/man/ped2mit.Rd
index 0f449b00..b4992fb9 100644
--- a/man/ped2mit.Rd
+++ b/man/ped2mit.Rd
@@ -28,9 +28,7 @@ ped2mit(
\arguments{
\item{ped}{a pedigree dataset. Needs ID, momID, and dadID columns}
-\item{max_gen}{the maximum number of generations to compute
-(e.g., only up to 4th degree relatives). The default is 25. However it can be set to infinity.
- `Inf` uses as many generations as there are in the data.}
+\item{max_gen}{the maximum number of iterations that the adjacency matrix is multiplied to get the relatedness matrix. `Inf` uses as many iterations as there are in the data. Defaults to 25.}
\item{sparse}{logical. If TRUE, use and return sparse matrices from Matrix package}
diff --git a/man/simulatePedigree.Rd b/man/simulatePedigree.Rd
index 36555c8e..c1b656ee 100644
--- a/man/simulatePedigree.Rd
+++ b/man/simulatePedigree.Rd
@@ -25,7 +25,8 @@ simulatePedigree(
spouseID = "spouseID",
code_male = "M",
code_female = "F",
- fam_shift = 1L
+ fam_shift = 1L,
+ beta = FALSE
)
SimPed(...)
diff --git a/vignettes/v1_modelingvariancecomponents.html b/vignettes/v1_modelingvariancecomponents.html
index 84a077f9..fdb9da14 100644
--- a/vignettes/v1_modelingvariancecomponents.html
+++ b/vignettes/v1_modelingvariancecomponents.html
@@ -343,10 +343,10 @@ Modeling variance components
Introduction
-
This vignette provides a detailed guide to specific functions within
-the BGmisc package that aid in the identification and
-fitting of variance component models common in behavior genetics. We
-will explore key functions such as identifyComponentModel,
+
This vignette provides a detailed guide to specific functions in the
+BGmisc package that aid in the identification and fitting
+of variance component models common in behavior genetics. We will
+explore key functions such as identifyComponentModel,
providing practical examples and theoretical background. Identification
ensures a unique set of parameters that define the model-implied
covariance matrix, preventing free parameters from trading off one
@@ -421,113 +421,106 @@
Using identifyComponentModel Function
#> character(0)
As you can see the model is identified, now that we’ve added another
group. Let us confirm by fitting a model. First we prepare the data.
-require(dplyr)
-#> Loading required package: dplyr
-#>
-#> Attaching package: 'dplyr'
-#> The following objects are masked from 'package:stats':
-#>
-#> filter, lag
-#> The following objects are masked from 'package:base':
-#>
-#> intersect, setdiff, setequal, union
-
+library(dplyr)
+
+
+selVars <- c("ht1", "ht2")
+
+mzdzData <- subset(
+ twinData, zyg %in% c(1, 3),
+ c(selVars, "zyg")
+)
+
+mzdzData$RCoef <- c(1, NA, .5)[mzdzData$zyg]
-selVars <- c("ht1", "ht2")
-
-mzdzData <- subset(
- twinData, zyg %in% c(1, 3),
- c(selVars, "zyg")
-)
-
-mzdzData$RCoef <- c(1, NA, .5)[mzdzData$zyg]
-
-
-mzData <- mzdzData %>% filter(zyg == 1)
+
+mzData <- mzdzData %>% filter(zyg == 1)
Let us fit the data with MZ twins by themselves.
if (!requireNamespace("EasyMx", quietly = TRUE)) {
- print("Please install EasyMx to run the model fitting examples.")
+ print("Please install EasyMx to run the model fitting examples.")
} else {
-run1 <- emxTwinModel(
- model = "Cholesky",
- relatedness = "RCoef",
- data = mzData,
- use = selVars,
- run = TRUE, name = "TwCh"
-)
-
-summary(run1)
-}
-#> Running TwCh with 4 parameters
-#> Summary of TwCh
-#>
-#> free parameters:
-#> name matrix row col Estimate Std.Error A lbound ubound
-#> 1 sqrtA11 sqrtA 1 1 0.05122646 NA 1e-06
-#> 2 sqrtC11 sqrtC 1 1 0.03518629 NA 0!
-#> 3 sqrtE11 sqrtE 1 1 0.02325722 0.0007017955 ! 0!
-#> 4 Mht1 Means ht1 1 1.62974908 0.0027023907
-#>
-#> Model Statistics:
-#> | Parameters | Degrees of Freedom | Fit (-2lnL units)
-#> Model: 4 1112 -3693.148
-#> Saturated: 5 1111 NA
-#> Independence: 4 1112 NA
-#> Number of observations/statistics: 569/1116
-#>
-#> Information Criteria:
-#> | df Penalty | Parameters Penalty | Sample-Size Adjusted
-#> AIC: -5917.148 -3685.148 -3685.078
-#> BIC: -10747.543 -3667.773 -3680.471
-#> To get additional fit indices, see help(mxRefModels)
-#> timestamp: 2026-01-07 10:34:22
-#> Wall clock time: 0.0555501 secs
-#> optimizer: SLSQP
-#> OpenMx version number: 2.22.10
-#> Need help? See help(mxSummary)
+ library(EasyMx)
+ run1 <- emxTwinModel(
+ model = "Cholesky",
+ relatedness = "RCoef",
+ data = mzData,
+ use = selVars,
+ run = TRUE, name = "TwCh"
+ )
+
+ summary(run1)
+}
+#> Running TwCh with 4 parameters
+#> Summary of TwCh
+#>
+#> free parameters:
+#> name matrix row col Estimate Std.Error A lbound ubound
+#> 1 sqrtA11 sqrtA 1 1 0.05122646 NA 1e-06
+#> 2 sqrtC11 sqrtC 1 1 0.03518629 NA 0!
+#> 3 sqrtE11 sqrtE 1 1 0.02325722 0.0007017955 ! 0!
+#> 4 Mht1 Means ht1 1 1.62974908 0.0027023907
+#>
+#> Model Statistics:
+#> | Parameters | Degrees of Freedom | Fit (-2lnL units)
+#> Model: 4 1112 -3693.148
+#> Saturated: 5 1111 NA
+#> Independence: 4 1112 NA
+#> Number of observations/statistics: 569/1116
+#>
+#> Information Criteria:
+#> | df Penalty | Parameters Penalty | Sample-Size Adjusted
+#> AIC: -5917.148 -3685.148 -3685.078
+#> BIC: -10747.543 -3667.773 -3680.471
+#> To get additional fit indices, see help(mxRefModels)
+#> timestamp: 2026-01-23 17:36:46
+#> Wall clock time: 0.05960393 secs
+#> optimizer: SLSQP
+#> OpenMx version number: 2.22.10
+#> Need help? See help(mxSummary)
As you can see the model was unsuccessful because it was not
identified. But when we add another group, so that the model is
identified, the model now fits.
if (!requireNamespace("EasyMx", quietly = TRUE)) {
- print("Please install EasyMx to run the model fitting examples.")
+ print("Please install EasyMx to run the model fitting examples.")
} else {
-run2 <- emxTwinModel(
- model = "Cholesky",
- relatedness = "RCoef",
- data = mzdzData,
- use = selVars,
- run = TRUE, name = "TwCh"
-)
-
-summary(run2)
-}
-#> Running TwCh with 4 parameters
-#> Summary of TwCh
-#>
-#> free parameters:
-#> name matrix row col Estimate Std.Error A lbound ubound
-#> 1 sqrtA11 sqrtA 1 1 0.06339271 0.0014377690 1e-06
-#> 2 sqrtC11 sqrtC 1 1 0.00000100 0.0250260004 ! 0!
-#> 3 sqrtE11 sqrtE 1 1 0.02330040 0.0007015267 0!
-#> 4 Mht1 Means ht1 1 1.63295540 0.0020511844
-#>
-#> Model Statistics:
-#> | Parameters | Degrees of Freedom | Fit (-2lnL units)
-#> Model: 4 1803 -5507.092
-#> Saturated: 5 1802 NA
-#> Independence: 4 1803 NA
-#> Number of observations/statistics: 920/1807
-#>
-#> Information Criteria:
-#> | df Penalty | Parameters Penalty | Sample-Size Adjusted
-#> AIC: -9113.092 -5499.092 -5499.048
-#> BIC: -17811.437 -5479.794 -5492.498
-#> To get additional fit indices, see help(mxRefModels)
-#> timestamp: 2026-01-07 10:34:22
-#> Wall clock time: 0.04742312 secs
-#> optimizer: SLSQP
-#> OpenMx version number: 2.22.10
-#> Need help? See help(mxSummary)
+ library(EasyMx)
+ run2 <- emxTwinModel(
+ model = "Cholesky",
+ relatedness = "RCoef",
+ data = mzdzData,
+ use = selVars,
+ run = TRUE, name = "TwCh"
+ )
+
+ summary(run2)
+}
+#> Running TwCh with 4 parameters
+#> Summary of TwCh
+#>
+#> free parameters:
+#> name matrix row col Estimate Std.Error A lbound ubound
+#> 1 sqrtA11 sqrtA 1 1 0.06339271 0.0014377690 1e-06
+#> 2 sqrtC11 sqrtC 1 1 0.00000100 0.0250260004 ! 0!
+#> 3 sqrtE11 sqrtE 1 1 0.02330040 0.0007015267 0!
+#> 4 Mht1 Means ht1 1 1.63295540 0.0020511844
+#>
+#> Model Statistics:
+#> | Parameters | Degrees of Freedom | Fit (-2lnL units)
+#> Model: 4 1803 -5507.092
+#> Saturated: 5 1802 NA
+#> Independence: 4 1803 NA
+#> Number of observations/statistics: 920/1807
+#>
+#> Information Criteria:
+#> | df Penalty | Parameters Penalty | Sample-Size Adjusted
+#> AIC: -9113.092 -5499.092 -5499.048
+#> BIC: -17811.437 -5479.794 -5492.498
+#> To get additional fit indices, see help(mxRefModels)
+#> timestamp: 2026-01-23 17:36:46
+#> Wall clock time: 0.04078603 secs
+#> optimizer: SLSQP
+#> OpenMx version number: 2.22.10
+#> Need help? See help(mxSummary)
diff --git a/vignettes/v2_pedigree.html b/vignettes/v2_pedigree.html
index b9c6dac0..b8f34803 100644
--- a/vignettes/v2_pedigree.html
+++ b/vignettes/v2_pedigree.html
@@ -48,8 +48,9 @@
}