Description Usage Arguments Details Value Note Author(s) See Also Examples

Calculate, extract or set normalized model likelihoods (‘Akaike weights’).

1 2 |

`x` |
a numeric vector of information criterion values such as AIC, or
objects returned by functions like |

`value` |
numeric, the new weights for the |

The replacement function can assign new weights to an `"averaging"`

object, affecting coefficient values and order of component models.

For the extractor, a numeric vector of normalized likelihoods.

On assigning new weights, the model order changes accordingly, so assigning
the same weights again will cause incorrect re-calculation of averaged
coefficients. To avoid that, either re-set model weights by assigning `NULL`

,
or use ordered weights.

Kamil Bartoń

`armWeights`

,
`bootWeights`

, `BGWeights`

, `cos2Weights`

,
`jackknifeWeights`

and `stackingWeights`

can be used to
produce model weights.

`weights`

, which extracts fitting weights from model objects.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | ```
fm1 <- glm(Prop ~ dose, data = Beetle, family = binomial)
fm2 <- update(fm1, . ~ . + I(dose^2))
fm3 <- update(fm1, . ~ log(dose))
fm4 <- update(fm3, . ~ . + I(log(dose)^2))
round(Weights(AICc(fm1, fm2, fm3, fm4)), 3)
am <- model.avg(fm1, fm2, fm3, fm4, rank = AICc)
coef(am)
# Assign equal weights to all models:
Weights(am) <- rep(1, 4) # assigned weights are rescaled to sum to 1
Weights(am)
coef(am)
# Assign dummy weights:
wts <- c(2,1,4,3)
Weights(am) <- wts
coef(am)
# Component models are now sorted according to the new weights.
# The same weights assigned again produce incorrect results!
Weights(am) <- wts
coef(am) # wrong!
#
Weights(am) <- NULL # reset to original model weights
Weights(am) <- wts
coef(am) # correct
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.