-
Notifications
You must be signed in to change notification settings - Fork 0
/
tornado_glm.R
34 lines (32 loc) · 1.06 KB
/
tornado_glm.R
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
30
31
32
33
34
# Copyright 2019 Robert Carnell
#' GLM Tornado Diagram
#'
#' @inherit tornado description
#'
#' @inheritParams tornado
#'
#' @inherit tornado return
#' @export
#' @method tornado glm
#' @importFrom stats family
#'
#' @seealso \code{\link{tornado}}
#'
#' @examples
#' gtest <- glm(mpg ~ cyl*wt*hp, data = mtcars, family = gaussian)
#' torn <- tornado(gtest, type = "PercentChange", alpha = 0.10)
#' plot(torn, xlabel = "MPG")
tornado.glm <- function(model, type="PercentChange", alpha=0.10,
dict=NA, ...)
{
extraArguments <- list(...)
ret <- .create_plot_data(model = model, modeldata = model$data,
type = type, alpha = alpha,
dict = dict)
return(structure(list(data = list(plotdat = ret$plotdat,
pmeans = ret$pmeans,
factordat = ret$factor_plotdat),
type = "glm",
family = stats::family(model)$family),
class = "tornado_plot"))
}