data.path <- system.file("extdata","primate-example.data.csv", package="mmodely")
data <- read.csv(data.path, row.names=1)
pvs <- names(data[3:5])
data$gn_sp <- rownames(data)
tree.path <- system.file("extdata","primate-springer.2012.tre", package="mmodely")
phyl <- ape::read.tree(tree.path)[[5]]
mods <- get.model.combos(predictor.vars=pvs, outcome.var='OC', min.q=2)
PGLSi <- pgls.iter(models=mods, phylo=phyl, df=data, k=1,l=1,d=1)
# sprinkle in some missing data so as to make model selection more interesting
for(pv in pvs){ data[sample(x=1:nrow(data),size=2),pv] <- NA}
PGLSi <- pgls.iter(models=mods, phylo=phyl, df=data, k=1,l=1,d=1)
# find the lowest AIC within each q by n sized sub-dataset
plot.pgls.iters(x=PGLSi)
Run the code above in your browser using DataLab