dpm
objects support the broom package's tidy
method.
# S3 method for dpm
tidy(x, conf.int = FALSE, conf.level = 0.95, ...)
# S3 method for dpm
glance(x, ...)
A dpm
object.
Logical indicating whether or not to include a confidence interval in the tidy data frame.
The confidence level to use for the confidence interval
when conf.int
is TRUE. Default is .95, corresponding to a 95% confidence
interval.
Other arguments passed to summary.dpm.
A tibble::tibble() with information about model components. These will be
coefficient estimates (for tidy()
) or model fit (for glance()
),
following the naming standards established by the broom package.
if (requireNamespace("broom")) {
library(broom)
# Load example data
data("WageData", package = "panelr")
# Convert data to panel_data format for ease of use
wages <- panel_data(WageData, id = id, wave = t)
fit <- dpm(wks ~ pre(lag(union)) + lag(lwage) | ed, data = wages)
tidy(fit)
}
#> Loading required namespace: broom
#> Registered S3 methods overwritten by 'broom':
#> method from
#> tidy.glht jtools
#> tidy.summary.glht jtools
#> # A tibble: 4 × 6
#> term estimate std.error statistic p.value t
#> <chr> <dbl> <dbl> <dbl> <dbl> <lgl>
#> 1 union (t - 1) -1.19 0.513 -2.32 0.0203 NA
#> 2 lwage (t - 1) 0.642 0.484 1.33 0.185 NA
#> 3 ed -0.112 0.0558 -2.01 0.0443 NA
#> 4 wks (t - 1) 0.187 0.0202 9.28 0 NA