| 1 |
% Generated by roxygen2: do not edit by hand |
| 2 |
% Please edit documentation in R/mfx.R |
| 3 |
\name{tidy.betamfx} |
| 4 |
\alias{tidy.betamfx} |
| 5 |
\title{Tidy a(n) betamfx object} |
| 6 |
\usage{ |
| 7 |
\method{tidy}{betamfx}(x, conf.int = FALSE, conf.level = 0.95, ...) |
| 8 |
} |
| 9 |
\arguments{ |
| 10 |
\item{x}{A \code{betamfx} object.} |
| 11 |
|
| 12 |
\item{conf.int}{Logical indicating whether or not to include a confidence |
| 13 |
interval in the tidied output. Defaults to \code{FALSE}.} |
| 14 |
|
| 15 |
\item{conf.level}{The confidence level to use for the confidence interval |
| 16 |
if \code{conf.int = TRUE}. Must be strictly greater than 0 and less than 1. |
| 17 |
Defaults to 0.95, which corresponds to a 95 percent confidence interval.} |
| 18 |
|
| 19 |
\item{...}{Additional arguments. Not used. Needed to match generic |
| 20 |
signature only. \strong{Cautionary note:} Misspelled arguments will be |
| 21 |
absorbed in \code{...}, where they will be ignored. If the misspelled |
| 22 |
argument has a default value, the default value will be used. |
| 23 |
For example, if you pass \code{conf.lvel = 0.9}, all computation will |
| 24 |
proceed using \code{conf.level = 0.95}. Two exceptions here are: |
| 25 |
\itemize{ |
| 26 |
\item \code{tidy()} methods will warn when supplied an \code{exponentiate} argument if |
| 27 |
it will be ignored. |
| 28 |
\item \code{augment()} methods will warn when supplied a \code{newdata} argument if it |
| 29 |
will be ignored. |
| 30 |
}} |
| 31 |
} |
| 32 |
\description{ |
| 33 |
Tidy summarizes information about the components of a model. |
| 34 |
A model component might be a single term in a regression, a single |
| 35 |
hypothesis, a cluster, or a class. Exactly what tidy considers to be a |
| 36 |
model component varies across models but is usually self-evident. |
| 37 |
If a model has several distinct types of components, you will need to |
| 38 |
specify which components to return. |
| 39 |
} |
| 40 |
\details{ |
| 41 |
The \code{mfx} package provides methods for calculating marginal effects |
| 42 |
for various generalized linear models (GLMs). Unlike standard linear |
| 43 |
models, estimated model coefficients in a GLM cannot be directly |
| 44 |
interpreted as marginal effects (i.e., the change in the response variable |
| 45 |
predicted after a one unit change in one of the regressors). This is |
| 46 |
because the estimated coefficients are multiplicative, dependent on both |
| 47 |
the link function that was used for the estimation and any other variables |
| 48 |
that were included in the model. When calculating marginal effects, users |
| 49 |
must typically choose whether they want to use i) the average observation |
| 50 |
in the data, or ii) the average of the sample marginal effects. See |
| 51 |
\code{vignette("mfxarticle")} from the \code{mfx} package for more details. |
| 52 |
} |
| 53 |
\examples{ |
| 54 |
\dontshow{if (rlang::is_installed("mfx")) withAutoprint(\{ # examplesIf} |
| 55 |
|
| 56 |
library(mfx) |
| 57 |
|
| 58 |
# Simulate some data |
| 59 |
set.seed(12345) |
| 60 |
n <- 1000 |
| 61 |
x <- rnorm(n) |
| 62 |
|
| 63 |
# Beta outcome |
| 64 |
y <- rbeta(n, shape1 = plogis(1 + 0.5 * x), shape2 = (abs(0.2 * x))) |
| 65 |
# Use Smithson and Verkuilen correction |
| 66 |
y <- (y * (n - 1) + 0.5) / n |
| 67 |
|
| 68 |
d <- data.frame(y, x) |
| 69 |
mod_betamfx <- betamfx(y ~ x | x, data = d) |
| 70 |
|
| 71 |
tidy(mod_betamfx, conf.int = TRUE) |
| 72 |
|
| 73 |
# Compare with the naive model coefficients of the equivalent betareg call (not run) |
| 74 |
# tidy(betamfx(y ~ x | x, data = d), conf.int = TRUE) |
| 75 |
|
| 76 |
augment(mod_betamfx) |
| 77 |
glance(mod_betamfx) |
| 78 |
\dontshow{\}) # examplesIf} |
| 79 |
} |
| 80 |
\seealso{ |
| 81 |
\code{\link[=tidy.betareg]{tidy.betareg()}}, \code{\link[mfx:betamfx]{mfx::betamfx()}} |
| 82 |
|
| 83 |
Other mfx tidiers: |
| 84 |
\code{\link{augment.betamfx}()}, |
| 85 |
\code{\link{augment.mfx}()}, |
| 86 |
\code{\link{glance.betamfx}()}, |
| 87 |
\code{\link{glance.mfx}()}, |
| 88 |
\code{\link{tidy.mfx}()} |
| 89 |
} |
| 90 |
\concept{mfx tidiers} |
| 91 |
\value{ |
| 92 |
A \code{\link[tibble:tibble]{tibble::tibble()}} with columns: |
| 93 |
\item{conf.high}{Upper bound on the confidence interval for the estimate.} |
| 94 |
\item{conf.low}{Lower bound on the confidence interval for the estimate.} |
| 95 |
\item{estimate}{The estimated value of the regression term.} |
| 96 |
\item{p.value}{The two-sided p-value associated with the observed statistic.} |
| 97 |
\item{statistic}{The value of a T-statistic to use in a hypothesis that the regression term is non-zero.} |
| 98 |
\item{std.error}{The standard error of the regression term.} |
| 99 |
\item{term}{The name of the regression term.} |
| 100 |
\item{atmean}{TRUE if the marginal effects were originally calculated as the |
| 101 |
partial effects for the average observation. If FALSE, then these were |
| 102 |
instead calculated as average partial effects.} |
| 103 |
|
| 104 |
} |