# An R Package for Extended Behavior Genetics Analysis

## Documentation for package ‘BGmisc’ version 1.6.0.1

- DESCRIPTION file
- User guides, package vignettes and other documentation
- Package NEWS
- Package README

## Help Pages

A B C D E F H I M P R S T V misc

## -- A --

addParentRow | Create a properly formatted parent row for the pedigree
addPersonToPed | addPersonToPed
addRowlessParents | Add addRowlessParents
allGens | calcAllGens A function to calculate the number of individuals in each generation. This is a supporting function for 'simulatePedigree'.
applyTagMappings | Apply Tag Mappings to a Line

## -- B --

buildBtwnGenerations | Process Generation Connections
buildFamilyGroups | Build family group models
buildOneFamilyGroup | Build one family group model
buildPedigreeModelCovariance | Create an mxModel for a pedigree
buildPedigreeMx | Build Pedigree mxModel
buildWithinGenerations | Process Generations for Pedigree Simulation

## -- C --

calcAllGens | calcAllGens A function to calculate the number of individuals in each generation. This is a supporting function for 'simulatePedigree'.
calcFamilySize | calcFamilySize A function to calculate the total number of individuals in a pedigree given parameters. This is a supporting function for function 'simulatePedigree'
calcFamilySizeByGen | calcFamilySizeByGen An internal supporting function for 'simulatePedigree'.
calculateCIs | Confidence Intervals for Correlations with Optional Design-Effect Adjustment
calculateH | Falconer's Formula
calculateRelatedness | Calculate Relatedness Coefficient
checkIDs | Validates and Optionally Repairs Unique IDs in a Pedigree Dataframe
checkIDuniqueness | Check for duplicated individual IDs
checkParentIDs | Validates and Optionally Repairs Parent IDs in a Pedigree Dataframe
checkParentSex | Check Parental Role Sex Consistency
checkPedigreeNetwork | Validate Pedigree Network Structure
checkSex | Validates and Optionally Repairs Sex Coding in a Pedigree Dataframe
checkWithinRowDuplicates | Check for within-row duplicates (self-parents, same mom/dad)
collapseNames | collapse Names
com2links | Convert Sparse Relationship Matrices to Kinship Links
comp2vech | comp2vech Turn a variance component relatedness matrix into its half-vectorization
computeParentAdjacency | Compute Parent Adjacency Matrix with Multiple Approaches
countPatternRows | Count GEDCOM Pattern Rows
createGenDataFrame | Create Data Frame for Generation
createGenDataFrame_beta | Create Data Frame for Generation

## -- D --

determineSex | Determine Sex of Offspring
determineSex_beta | Determine Sex of Offspring
dropIdenticalDuplicateIDs | Drop Identical Duplicate IDs from Pedigree Data Frame
dropLink | dropLink

## -- E --

evenInsert | evenInsert A function to insert m elements evenly into a length n vector.

## -- F --

famSizeCal | calcFamilySize A function to calculate the total number of individuals in a pedigree given parameters. This is a supporting function for function 'simulatePedigree'
findBiggest | Function to find the biggest families in a pedigree This function finds the biggest families in a pedigree. It is supposed to be used internally by the 'summarize_pedigree' function.
findbiggest | Function to find the biggest families in a pedigree This function finds the biggest families in a pedigree. It is supposed to be used internally by the 'summarize_pedigree' function.
findOldest | Function to find the oldest individuals in a pedigree This function finds the oldest families in a pedigree. It is supposed to be used internally by the 'summarize_pedigree' function.
findoldest | Function to find the oldest individuals in a pedigree This function finds the oldest families in a pedigree. It is supposed to be used internally by the 'summarize_pedigree' function.
fitComponentModel | fitComponentModel Fit the estimated variance components of a model to covariance data
fitPedigreeModel | Fit an OpenMx pedigree model to observed data
fuseTwins | Fuse MZ twin pairs in a pedigree dataset for path tracing This function identifies MZ twin pairs in the pedigree dataset and merges their IDs for path tracing purposes. The second twin in each pair is made a founder (with NA parents), and all children of the second twin are redirected to the first twin. This allows for correct relatedness calculations without diagonal or downstream artifacts.

## -- H --

hazard | Simulated pedigree with two extended families and an age-related hazard

## -- I --

identifyComponentModel | identifyComponentModel Determine if a variance components model is identified
inbreeding | Artificial pedigree data on eight families with inbreeding
initializeRecord | Initialize an Empty Individual Record
insertEven | evenInsert A function to insert m elements evenly into a length n vector.

## -- M --

makeInbreeding | makeInbreeding
makeTwins | makeTwins
mapFAMS2parents | Create a Mapping from Family IDs to Parent IDs
markPotentialChildren | Mark and Assign children
markPotentialChildren_beta | Mark and Assign children

## -- P --

parseNameLine | Parse Name Line
ped2add | Take a pedigree and turn it into an additive genetics relatedness matrix
ped2ce | Take a pedigree and turn it into an extended environmental relatedness matrix
ped2cn | Take a pedigree and turn it into a common nuclear environmental matrix
ped2com | Take a pedigree and turn it into a relatedness matrix
ped2fam | Segment Pedigree into Extended Families
ped2gen | Take a pedigree and turn it into a generation relatedness matrix
ped2graph | Turn a pedigree into a graph
ped2maternal | Add a maternal line ID variable to a pedigree
ped2mit | Take a pedigree and turn it into a mitochondrial relatedness matrix
ped2mt | Take a pedigree and turn it into a mitochondrial relatedness matrix
ped2paternal | Add a paternal line ID variable to a pedigree
postProcessGedcom | Post-process GEDCOM Data Frame
potter | Fictional pedigree data on a wizarding family
prepSummarizePedigrees | Function to prepare the pedigree for summarization This function prepares the pedigree for summarization by ensuring that the necessary IDs are present and that the pedigree is built correctly.
processEventLine | Process Event Lines (Birth or Death)
processParents | Process Parents Information from GEDCOM Data

## -- R --

readGed | Read a GEDCOM File
readGedcom | Read a GEDCOM File
readgedcom | Read a GEDCOM File
readWikifamilytree | Read Wiki Family Tree
recodeSex | Recodes Sex Variable in a Pedigree Dataframe
related_coef | Calculate Relatedness Coefficient
repairIDs | Repair Missing IDs
repairParentIDs | Repair Parent IDs
repairSex | Repairs Sex Coding in a Pedigree Dataframe
restorePedColnames | Restore Original Column Names in a Pedigree Dataframe
royal92 | Royal pedigree data from 1992

## -- S --

SimPed | Simulate Pedigrees This function simulates "balanced" pedigrees based on a group of parameters: 1) k - Kids per couple; 2) G - Number of generations; 3) p - Proportion of males in offspring; 4) r - Mating rate.
simulatePedigree | Simulate Pedigrees This function simulates "balanced" pedigrees based on a group of parameters: 1) k - Kids per couple; 2) G - Number of generations; 3) p - Proportion of males in offspring; 4) r - Mating rate.
sizeAllGens | calcFamilySizeByGen An internal supporting function for 'simulatePedigree'.
sliceFamilies | sliceFamilies
summariseFamilies | Summarize the families in a pedigree
summarisefamilies | Summarize the families in a pedigree
summariseMatrilines | Summarize the maternal lines in a pedigree
summarisematrilines | Summarize the maternal lines in a pedigree
summarisePatrilines | Summarize the paternal lines in a pedigree
summarisepatrilines | Summarize the paternal lines in a pedigree
summarisePedigrees | Summarize Pedigree Data
summarisepedigrees | Summarize Pedigree Data
summarizeFamilies | Summarize the families in a pedigree
summarizefamilies | Summarize the families in a pedigree
summarizeMatrilines | Summarize the maternal lines in a pedigree
summarizematrilines | Summarize the maternal lines in a pedigree
summarizePatrilines | Summarize the paternal lines in a pedigree
summarizepatrilines | Summarize the paternal lines in a pedigree
summarizePedigrees | Summarize Pedigree Data
summarizepedigrees | Summarize Pedigree Data

## -- T --

traceTreePaths | Trace paths between individuals in a family tree grid

## -- V --

validate_and_convert_matrix | validate_and_convert_matrix
vech | vech Create the half-vectorization of a matrix

## -- misc --

.adjBeta | Construct Adjacency Matrix for Parent-Child Relationships Using Beta Methods This function constructs an adjacency matrix for parent-child relationships using a method in beta testing. It identifies parent-child pairs based on the specified component of relatedness.
.adjDirect | Construct Adjacency Matrix for Parent-Child Relationships Using Direct Method
.adjIndexed | Construct Adjacency Matrix for Parent-Child Relationships Using Indexed Method
.assignParentValue | Assign parent values based on component type
.computeTranspose | Compute the transpose multiplication for the relatedness matrix
.loadOrComputeIsChild | Load or compute the isChild matrix
.postProcessGedcom.legacy | Post-process GEDCOM Data Frame