https://github.com/cran/MuMIn
Tip revision: f8469f452d8a1be30d399d978de9550b4632bb51 authored by Kamil BartoĊ on 31 January 2012, 16:44:51 UTC
version 1.7.2
version 1.7.2
Tip revision: f8469f4
Weights.R
# Calculate Akaike weights
`Weights` <-
function(x) UseMethod("Weights")
`Weights.model.selection` <-
function(x) x[, "weight"] / sum(x[, "weight"])
`Weights.averaging` <-
function(x) x$summary$Weight
`Weights.data.frame` <-
function(x) {
if(ncol(x) == 2L && colnames(x)[2L] %in% c("AIC", "AICc", "BIC", "QAIC", "QAICc")
&& is.numeric(x[, 2L]))
Weights.default(x[, 2L])
else NA
}
`Weights.default` <-
function(x) {
delta <- x - min(x)
weight <- exp(-delta / 2) / sum(exp(-delta / 2))
return (weight)
}