Description Usage Arguments Value Examples

View source: R/goodness_of_fit.R

Calculates the goodness of fit test statistics for contingency tables

1 | ```
goodness_of_fit(model, type = "Chisq", ...)
``` |

`model` |
a GLM regression model. |

`type` |
either "Chisq" or "Gsq", which determines the type of goodness of fit test that is ran. Defaults to "Chisq". |

`...` |
Further arguments passed to or from other methods. |

A list with class "`ct_goodness_of_fit`

" containing the following components:

`test`

the type of test used.

`model`

the name of the inputted model.

`statistic`

The value of the test statistic as determined by the type parameter

`df`

The number of degrees of freedom.
This equals the number of combinations for explanatory variables less the number of parameters in the model

`p.value`

The p-value calculated under a Chi-Squared distribution.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ```
lung_logit <-
lung_cancer %>%
flatten_ct() %>%
glm(
Lung ~ Smoking
,family = binomial
,data = .
)
goodness_of_fit(model = lung_logit, type = "Chisq")
lung_logit %>%
goodness_of_fit(type = "Gsq")
lung_cancer %>%
flatten_ct() %>%
glm(
Lung ~ City + Smoking
,family = binomial
,data = .
) %>%
goodness_of_fit()
``` |

EvilGRAHAM/flatr documentation built on Feb. 23, 2018, 3:32 p.m.

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.