Description Usage Arguments Details Value References See Also Examples

View source: R/adj_loglik_methods.R

`anova`

method for `chantrics`

objects

1 2 |

`object` |
Object of class |

`...` |
Further objects of class |

Create an analysis of adjusted deviance table for one object (sequential), or
two or more nested models that have been adjusted using the
`adj_loglik()`

method. It uses the adjusted likelihood ratio test
statistic (ALRTS), as described in Section 3.5 of
Chandler and Bate (2007).

Each line represents the model as given above the table, with each line (except for the first line) showing the residual degrees of freedom of that model, the change in degrees of freedom, the ALRTS and the associated p-value in comparison to the model in the line above.

When a single model is specified, the function returns a sequential analysis of deviance table, where, iteratively, one term is being removed from the right of the full formula. This process is continued until the "intercept only" model is left. The row names are the names of the dropped term in comparison to the model in the line above.

If more than one model is specified, the function sorts the models by their
number of variables as returned by `adj_loglik()`

in
`attr(x, "p_current")`

.

Details of the ALRT can be found in `chandwich::compare_models()`

and in
Chandler and Bate (2007).

An object of class `"anova"`

inheriting from class `"data.frame"`

.
The columns are as follows:

`Resid.df` |
The residual number of degrees of freedom in the model. |

`df` |
The increase in residual degrees of freedom with respect to the model in the row above. |

`ALRTS` |
The adjusted likelihood ratio statistic. |

`Pr(>ALRTS)` |
The p-value of the test that the model above is a "significantly better" model as the one in the current row. |

R. E. Chandler and S. Bate, Inference for clustered data using the independence loglikelihood, Biometrika, 94 (2007), pp. 167–183. doi: 10.1093/biomet/asm015.

chandwich::compare_models: implementation of the comparison mechanism

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ```
# from Introducing Chandwich.
set.seed(123)
x <- rnorm(250)
y <- rnbinom(250, mu = exp(1 + x), size = 1)
fm_pois <- glm(y ~ x + I(x^2), family = poisson)
fm_pois_adj <- adj_loglik(fm_pois)
fm_pois_small_adj <- update(fm_pois_adj, formula = . ~ . - I(x^2))
fm_pois_smallest_adj <- update(fm_pois_adj, formula = . ~ 1)
anova(fm_pois_adj, fm_pois_small_adj, fm_pois_smallest_adj)
# use different types of adjustment with type, default is "vertical"
anova(fm_pois_adj, fm_pois_small_adj, fm_pois_smallest_adj, type = "cholesky")
# sequential anova
anova(fm_pois_adj)
``` |

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.