PdataPed {MasterBayes} | R Documentation |
PdataPed
creates an object of class PdataPed
, which typically contains the phenotype data to be passed to MCMCped
and the formula that defines the model to be fitted.
is.PdataPed
returns TRUE
if x
is of class PdataPed
PdataPed(formula, data=NULL, id=data$id, sex=data$sex, offspring=data$offspring, timevar=data$timevar, USdam=FALSE, USsire=FALSE, ...)
formula |
list of model predictors of the form expression(varPed(...)) |
data |
data frame containing the predictor variables |
id |
vector of individual identifiers. If not specified, data must have an id column |
sex |
vector of individual sexes (either 'Male' or 'Female' or NA ). If not specified individuals are assumed to be hermpahroditic unless data has a sex column |
offspring |
binary vector indicating whether records belong to offspring (1) or not (0) |
timevar |
an optional vector indicating cohorts for multigenerational pedigree reconstruction |
USdam |
logical or character; if TRUE a single undiferentaited population of unsampled females exists. If USdam is a character vector it must have the same length as id with factor levels representing sub-populations (in time or space) over which the number of unsampled females vary. |
USsire |
logical or character; if TRUE a single undiferentaited population of unsampled males exists. If USsire is a character vector it must have the same length as id with factor levels representing sub-populations (in time or space) over which the number of unsampled males vary. |
... |
further arguments to be passed |
If the number of unsampled individuals varies over subpopulations, and the parentage of an offspring is not restricted to ceratin subpopulations then the parameters will not be idenifiable. This can be resolved by using an informative prior (see priorPed
) for the number of unsampled individuals in each sub-population, or using the restrict
argument in varPed
.
list containing the arguments passed
Jarrod Hadfield j.hadfield@ed.ac.uk
id<-1:20 sex<-sample(c("Male", "Female"),20, replace=TRUE) offspring<-c(rep(0,18),1,1) lat<-rnorm(20) long<-rnorm(20) mating_type<-gl(2,10, label=c("+", "-")) test.data<-data.frame(id, offspring, lat, long, mating_type, sex) res1<-expression(varPed("offspring", restrict=0)) var1<-expression(varPed(c("lat", "long"), gender="Male", relational="OFFSPRING")) var2<-expression(varPed(c("mating_type"), gender="Female", relational="MATE")) var3<-expression(varPed("mating_type", gender="Male")) PdP<-PdataPed(formula=list(res1, var1, var2, var3), data=test.data)