fpederr: Simulates a pedigree with errors and missing data from a...

Description Usage Arguments Value Author(s) References See Also Examples

Description

Implements the 'forward' approach to producing pairs of pedigrees for power and sensitivity analyses.

Usage

1
2
3
4
fpederr(truePedigree, founders = NULL, sex = NULL, samp = NULL, 
          sireE = NULL, damE = NULL, sireA = NULL, damA = NULL, 
          cohort = NULL, first = NULL, last = NULL, monoecey = 0, 
          modifyAssumedPedigree = 0)

Arguments

truePedigree

A complete pedigree with records for all individuals and parental ID's for all non-founders

founders

A vector the same length as the pedigree containing indicator variables 1 = founder, 0 = non-founder

sex

A vector the same length as the pedigree indicating sex, 0=male, 1=female, any other value = unknown sex

samp

A vector the same length as the pedigree indicating whether or not each individual is sampled (1), or an unsampled dummy individual (0).

sireE

Value(s) indicating the paternal error rate. If it is a single number (between 0 and 1), it is applied to the entire pedigree; if it is a vector the length of the pedigree, then probabilities can vary among individuals.

damE

Value(s) indicating the maternal error rate. If it is a single number (between 0 and 1), it is applied to the entire pedigree; if it is a vector the length of the pedigree, then probabilities can vary among individuals.

sireA

Value(s) indicating the paternal pedigree link assignment rate. If it is a single number (between 0 and 1), it is applied to the entire pedigree; if it is a vector the length of the pedigree, then probabilities can vary among individuals.

damA

Value(s) indicating the maternal pedigree link assignment rate. If it is a single number (between 0 and 1), it is applied to the entire pedigree; if it is a vector the length of the pedigree, then probabilities can vary among individuals.

cohort

A numeric vector the same length as the pedigree containing cohorts

first

A numeric vector the same length as the pedigree indicating the first cohort for which an individual is to be considered a potential parent

last

A numeric vector the same length as the pedigree indicating the last cohort for which an individual is to be considered a potential parent

monoecey

An indicator specifying whether or not bisexuality is allowed (0=no (default), 1=yes)

modifyAssumedPedigree

An indicator variable specifying whether or not an assumed pedigree with errors but no missing links should be supplied.

Value

assumedPedigree

A pedigree differing from the supplied pedigree so as to mimic patterns of pedigree errors and missing data that might occur in a real study.

truePedigree

Echos the pedigree supplied.

supplementalPedigree

(optional) a 'assumed' pedigree containing errorsbut no missing links.

Author(s)

Michael Morrissey michael.morrissey@ed.ac.uk

References

Morrissey et al. 2007. Journal of Evolutionary Biology 20:2309-2321., Morrissey, M.B, and A.J. Wilson, 2009. pedantics, an R package for pedigree-based genetic simulation, and pedigree manipulation, characterisation, and viewing. Molecular Ecology Resources.

See Also

rpederr,fpederr

Examples

 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
testData<-as.data.frame(matrix(c(
1,	NA,	NA,	1,	1,	1,	2,	2,
2,	NA,	NA,	1,	1,	1,	2,	2,
3,	NA,	NA,	1,	1,	1,	2,	2,
4,	NA,	NA,	1,	0,	1,	2,	2,
5,	NA,	NA,	1,	0,	1,	2,	2,
6,	1,	4,	0,	-1,	2,	3,	3,
7,	1,	4,	0,	-1,	2,	3,	3,
8,	1,	4,	0,	-1,	2,	3,	3,
9,	1,	4,	0,	-1,	2,	3,	3,
10,	2,	5,	0,	-1,	2,	3,	3,
11,	2,	5,	0,	-1,	2,	3,	3,
12,	2,	5,	0,	-1,	2,	3,	3,
13,	2,	5,	0,	-1,	2,	3,	3,
14,	3,	5,	0,	-1,	2,	3,	3,
15,	3,	5,	0,	-1,	2,	3,	3,
16,	3,	5,	0,	-1,	2,	3,	3,
17,	3,	5,	0,	-1,	2,	3,	3),
17,8,byrow=TRUE))

names(testData)<-c("id","dam","sire","founder","sex",
                                  "cohort","first","last")
pedigree<-as.data.frame(cbind(testData$id,testData$dam,
                                           testData$sire))
for(x in 1:3) pedigree[,x]<-as.factor(pedigree[,x])
names(pedigree)<-c("id","dam","sire")
pedigree

## some missing sire links:
fpederr(truePedigree=pedigree,founders=testData$founder,
        sex=testData$sex,sireA=0.5,cohort=testData$cohort,
        first=testData$first,last=testData$last)$assumedPedigree

## some erroneous sire links:
fpederr(truePedigree=pedigree,founders=testData$founder,
        sex=testData$sex,sireE=0.5,cohort=testData$cohort,
        first=testData$first,last=testData$last)$assumedPedigree

Example output

Loading required package: MasterBayes
Loading required package: coda
Loading required package: genetics
Loading required package: combinat

Attaching package: 'combinat'

The following object is masked from 'package:utils':

    combn

Loading required package: gdata
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to locate valid perl interpreter
gdata: 
gdata: read.xls() will be unable to read Excel XLS and XLSX files
gdata: unless the 'perl=' argument is used to specify the location of a
gdata: valid perl intrpreter.
gdata: 
gdata: (To avoid display of this message in the future, please ensure
gdata: perl is installed and available on the executable search path.)
sh: 1: cannot create /dev/null: Permission denied
gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLX' (Excel 97-2004) files.

gdata: Unable to load perl libaries needed by read.xls()
gdata: to support 'XLSX' (Excel 2007+) files.

gdata: Run the function 'installXLSXsupport()'
gdata: to automatically download and install the perl
gdata: libaries needed to support Excel XLS and XLSX formats.

Attaching package: 'gdata'

The following object is masked from 'package:stats':

    nobs

The following object is masked from 'package:utils':

    object.size

The following object is masked from 'package:base':

    startsWith

Loading required package: gtools
Loading required package: MASS
Loading required package: mvtnorm


NOTE: THIS PACKAGE IS NOW OBSOLETE.



  The R-Genetics project has developed an set of enhanced genetics

  packages to replace 'genetics'. Please visit the project homepage

  at http://rgenetics.org for informtion.




Attaching package: 'genetics'

The following objects are masked from 'package:base':

    %in%, as.factor, order

Loading required package: kinship2
Loading required package: Matrix
Loading required package: quadprog
Loading required package: MCMCglmm
Loading required package: ape
Loading required package: grid
   id  dam sire
1   1 <NA> <NA>
2   2 <NA> <NA>
3   3 <NA> <NA>
4   4 <NA> <NA>
5   5 <NA> <NA>
6   6    1    4
7   7    1    4
8   8    1    4
9   9    1    4
10 10    2    5
11 11    2    5
12 12    2    5
13 13    2    5
14 14    3    5
15 15    3    5
16 16    3    5
17 17    3    5

Sorting real parents...Done.

Assigning parents for assumed pedigree...Done.
   id sire  dam
1   1 <NA> <NA>
2   2 <NA> <NA>
3   3 <NA> <NA>
4   4 <NA> <NA>
5   5 <NA> <NA>
6   6    4    1
7   7    4    1
8   8    4    1
9   9 <NA>    1
10 10    5    2
11 11 <NA>    2
12 12 <NA>    2
13 13 <NA>    2
14 14    5    3
15 15 <NA>    3
16 16 <NA>    3
17 17    5    3

Sorting real parents...Done.

Assigning parents for assumed pedigree...Done.
   id sire  dam
1   1 <NA> <NA>
2   2 <NA> <NA>
3   3 <NA> <NA>
4   4 <NA> <NA>
5   5 <NA> <NA>
6   6    4    1
7   7    5    1
8   8    4    1
9   9    5    1
10 10    5    2
11 11    5    2
12 12    5    2
13 13    5    2
14 14    4    3
15 15    5    3
16 16    5    3
17 17    5    3

pedantics documentation built on May 1, 2019, 10:54 p.m.