Debian Codegraph @

man/tidy.lmodel2.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/lmodel2.R
3 \name{tidy.lmodel2}
4 \alias{tidy.lmodel2}
5 \alias{lmodel2_tidiers}
6 \title{Tidy a(n) lmodel2 object}
7 \usage{
8 \method{tidy}{lmodel2}(x, ...)
9 }
10 \arguments{
11 \item{x}{A \code{lmodel2} object returned by \code{\link[lmodel2:lmodel2]{lmodel2::lmodel2()}}.}
12
13 \item{...}{Additional arguments. Not used. Needed to match generic
14 signature only. \strong{Cautionary note:} Misspelled arguments will be
15 absorbed in \code{...}, where they will be ignored. If the misspelled
16 argument has a default value, the default value will be used.
17 For example, if you pass \code{conf.lvel = 0.9}, all computation will
18 proceed using \code{conf.level = 0.95}. Two exceptions here are:
19 \itemize{
20 \item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if
21 it will be ignored.
22 \item \code{augment()} methods will warn when supplied a \code{newdata} argument if it
23 will be ignored.
24 }}
25 }
26 \description{
27 Tidy summarizes information about the components of a model.
28 A model component might be a single term in a regression, a single
29 hypothesis, a cluster, or a class. Exactly what tidy considers to be a
30 model component varies across models but is usually self-evident.
31 If a model has several distinct types of components, you will need to
32 specify which components to return.
33 }
34 \details{
35 There are always only two terms in an \code{lmodel2}: \code{"Intercept"}
36 and \code{"Slope"}. These are computed by four methods: OLS
37 (ordinary least squares), MA (major axis), SMA (standard major
38 axis), and RMA (ranged major axis).
39
40 The returned p-value is one-tailed and calculated via a permutation test.
41 A permutational test is used because distributional assumptions may not
42 be valid. More information can be found in
43 \code{vignette("mod2user", package = "lmodel2")}.
44 }
45 \examples{
46 \dontshow{if (rlang::is_installed(c("lmodel2", "ggplot2"))) withAutoprint(\{ # examplesIf}
47
48 # load libraries for models and data
49 library(lmodel2)
50
51 data(mod2ex2)
52 Ex2.res <- lmodel2(Prey ~ Predators, data = mod2ex2, "relative", "relative", 99)
53 Ex2.res
54
55 # summarize model fit with tidiers + visualization
56 tidy(Ex2.res)
57 glance(Ex2.res)
58
59 # this allows coefficient plots with ggplot2
60 library(ggplot2)
61
62 ggplot(tidy(Ex2.res), aes(estimate, term, color = method)) +
63 geom_point() +
64 geom_errorbarh(aes(xmin = conf.low, xmax = conf.high)) +
65 geom_errorbarh(aes(xmin = conf.low, xmax = conf.high))
66 \dontshow{\}) # examplesIf}
67 }
68 \seealso{
69 \code{\link[=tidy]{tidy()}}, \code{\link[lmodel2:lmodel2]{lmodel2::lmodel2()}}
70
71 Other lmodel2 tidiers:
72 \code{\link{glance.lmodel2}()}
73 }
74 \concept{lmodel2 tidiers}
75 \value{
76 A \code{\link[tibble:tibble]{tibble::tibble()}} with columns:
77 \item{conf.high}{Upper bound on the confidence interval for the estimate.}
78 \item{conf.low}{Lower bound on the confidence interval for the estimate.}
79 \item{estimate}{The estimated value of the regression term.}
80 \item{p.value}{The two-sided p-value associated with the observed statistic.}
81 \item{term}{The name of the regression term.}
82 \item{method}{Either OLS/MA/SMA/RMA}
83
84 }