# NOT RUN {
## Seed
set.seed(49494)
# extract data
data(pedigree)
data(data)
pedigree0 <- pedigree
# inbreeding depression case
# fixed error proportions
lambda <- c(0.2, 0.3, 0.4, 0.5, 0.6)
# initial error proportion
lambda0 <- 0.1
# model used to compute inbreeding depression
model <- lm(y~sex+f_inb, data = data)
# PSIMEX
results <- Psimex(pedigree0, data,
lambda, lambda0, B = 100,
model, parameter = "inbreeding",
error = "missing", way = "uniform",
fitting.method = c("quadratic", "linear"),
ntop = NA, nbottom = NA,
prior, nitt, thin, burnin)
results$description
results$error
results$fitting.method
results$way
results$extrapolated_data
results$lambda
results$lambda0
results$starting.value
# }
# NOT RUN {
# heritability case
## Seed
set.seed(49494)
# extract data
data(pedigree)
data(data)
pedigree0 <- pedigree
# fixed error proportions
lambda <- c(0.2, 0.3, 0.4, 0.5, 0.6)
# initial error proportion
lambda0 <- 0.1
# model to compute heritability (MCMCglmm)
# prior specification
prior <- list(G=list(G1=list(V=matrix(1/3),n=1),
G2=list(V=matrix(1/3),n=1)),
R=list(V=matrix(1/3),n=1))
#to fulfill MCMCglmm requirements
pedigree <- pedigree0[ , c(1,2,3)]
names(pedigree) <- c("animal", "dam", "sire")
ord <- orderPed(pedigree)
pedigree <- pedigree[order(ord),]
# model specification
model <- MCMCglmm(y~1+sex, random = ~animal+id,
pedigree = pedigree, data = data,
prior = prior, nitt = 20000, thin = 100, burnin = 1000,
verbose = FALSE)
# PSIMEX
results1 <- Psimex(pedigree0, data,
lambda, lambda0, B = 10,
model, parameter = "heritability",
error = "missing", way = "uniform",
fitting.method = "quadratic",
ntop = NA, nbottom = NA,
prior = prior, nitt = 20000, thin = 100, burnin = 1000)
results1$description
results1$error
results1$fitting.method
results1$way
results1$extrapolated_data
results1$lambda
results1$lambda0
results1$starting.value
# }
Run the code above in your browser using DataLab