Commit 176d9a60 authored by kunstler's avatar kunstler
Browse files

ranef BLUP

parent b6709467
......@@ -46,6 +46,7 @@ summarise.lmer.output.list <- function(f ){
lmer.summary = summarise.lmer.output( output.lmer),
terms = terms(output.lmer),
vcov = vcov(output.lmer),
re1 = BLUP.CI(output.lmer),
relgrad = relgrad,
list.sd = list.sd)
}else{
......@@ -73,6 +74,7 @@ summarise.lmer.output.all.list <- function(f ){
model$var.BLUP),
terms = terms(output.lmer),
vcov = vcov(output.lmer),
re1 = BLUP.CI(output.lmer),
relgrad = relgrad,
list.sd = list.sd)
}else{
......@@ -102,15 +104,9 @@ files.details.all <- function(x){
s[-(1:2)]
}
BLUP.CI <- function(fm, var.BLUP){ ## NOT WORKING WHEN MULTIPLE term per factor
BLUP.CI <- function(fm, var.BLUP = 'species.id'){ ## NOT WORKING WHEN MULTIPLE term per factor
cV <- ranef(fm, condVar = TRUE, whichel = var.BLUP)
ranvar <- attr(cV[[1]], "postVar")
res <- do.call('rbind',
lapply(1:dim(ranvar)[3],
function(i, array) sqrt(diag(array[ , , i])),
array = ranvar))
colnames(res) <- names(cV[[1]])
return(res)
return(cV)
}
#### R squared functions
......
load.model <- function () {
list(name="lmer.LOGLIN.ER.AD.Tf.r.set.species",
var.BLUP = 'set.id',
lmer.formula.tree.id=formula("logG~1+(1|set.id)+(1|species.id)+(1|plot.id)+Tf+logD+sumBn+sumTfBn+sumTnBn+sumTnTfBn.abs +(logD-1|species.id) +(sumBn-1|species.id)+(Tf-1|set.id)+(sumBn-1|set.id)+(sumTfBn-1|set.id)+(sumTnBn-1|set.id)+(sumTnTfBn.abs-1|set.id)"))
lmer.formula.tree.id=formula("logG~1+Tf+logD+sumBn+sumTfBn+sumTnBn+sumTnTfBn.abs +(1+logD+sumBn||species.id)+(1|plot.id)+(1+Tf+sumBn+sumTfBn+sumTnBn+sumTnTfBn.abs||set.id)"))
}
......
......@@ -12,18 +12,18 @@ source("R/analysis/lmer.run.R")
## traits = c("SLA", "Wood.density", "Max.height")
## )
## format.all.output.lmer(file.name = "NA.wwf.results.nolog.all.rds",
## list.file.name = 'list.lmer.out.all.NA.simple.set.rds',
## models = c(model.files.lmer.Tf.1),
## traits = c("SLA", "Wood.density", "Max.height")
## )
format.all.output.lmer(file.name = "NA.wwf.results.nolog.all.rds",
list.file.name = 'list.lmer.out.all.NA.simple.set.TP.rds',
models = c(model.files.lmer.Tf.3),
list.file.name = 'list.lmer.out.all.NA.simple.set.rds',
models = c(model.files.lmer.Tf.1),
traits = c("SLA", "Wood.density", "Max.height")
)
## format.all.output.lmer(file.name = "NA.wwf.results.nolog.all.rds",
## list.file.name = 'list.lmer.out.all.NA.simple.set.TP.rds',
## models = c(model.files.lmer.Tf.3),
## traits = c("SLA", "Wood.density", "Max.height")
## )
## format.all.output.lmer(file.name = "NA.wwf.results.nolog.all.rds",
## list.file.name = 'list.lmer.out.all.NA.all.census.set.rds',
## models = c(model.files.lmer.Tf.2),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment