##############################################################################
# Negbin model processing functions
##############################################################################
# Run negbin model for each formula specified in formlist
runMod <- function(formlist, data){
out <- lapply(formlist, function(x) glm.nb(x, data))
names(out) <- names(formlist)
return(out)
}
# Build list of fitted values (with CHR/BIN names) for each model
getFits <- function(modlist, data){
out <- lapply(modlist,
function(x){
y <- fitted.values(x)
names(y) <- paste0(data$CHR, ".", data$BIN)
y
})
names(out) <- names(modlist)
return(out)
}
# Build list of dataframes for each model
buildDF <- function(fitlist, data){
out <- lapply(fitlist,
function(x){
data.frame(CHR, Category2=cat1, BIN,
exp=x,
obs=data$obs,
# res=names(fitlist),
stringsAsFactors=F)
}
)
names(out) <- names(fitlist)
return(out)
}
##############################################################################
# Compute standard error for correlations
##############################################################################
corSE <- function(corval, ct){
sqrt((1-corval^2)/(ct-2))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.