knitr::opts_chunk$set( collapse = TRUE, comment = "#>" )
To start, load the package.
library(JWileymisc)
modelPerformance()
is a generic function that can be used to
calculate performance metrics for a model. JWileymisc
implements
methods for lm
class objects. The output is a named list,
with a data table containing results. For linear models, current
performance metrics include:
mtcars$cyl <- factor(mtcars$cyl) m <- stats::lm(mpg ~ hp + cyl, data = mtcars) mp <- modelPerformance(m) print(mp)
If only certain metrics are desired, these can be found by extracting the "Performance" list element and then the correct column from the data table.
## Cohen's f^2 effect size mp$Performance[, F2]
Another function, modelTest()
is a generic providing a
comprehensive series of tests for a model. Currently methods are
implemented for both lm
class models and vglm
class models from
the VGAM
package with a multinomial family.
modelTest()
mt <- modelTest(m) print(mt)
APAStyler(mt)
The model tests can also be used with interactions.
m2 <- stats::lm(mpg ~ hp * cyl, data = mtcars) APAStyler(modelTest(m2))
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.