| 1 |
skip_on_cran() |
| 2 |
|
| 3 |
skip_if_not_installed("modeltests") |
| 4 |
library(modeltests) |
| 5 |
|
| 6 |
skip_if_not_installed("plm") |
| 7 |
suppressPackageStartupMessages(library(plm)) |
| 8 |
|
| 9 |
data(Produc, package = "plm") |
| 10 |
fit <- plm( |
| 11 |
log(gsp) ~ log(pcap) + log(pc) + log(emp) + unemp, |
| 12 |
data = Produc, |
| 13 |
index = c("state", "year") |
| 14 |
) |
| 15 |
|
| 16 |
test_that("plm tidier arguments", { |
| 17 |
check_arguments(tidy.plm) |
| 18 |
check_arguments(glance.plm) |
| 19 |
check_arguments(augment.plm) |
| 20 |
}) |
| 21 |
|
| 22 |
test_that("tidy.plm", { |
| 23 |
td <- tidy(fit, conf.int = TRUE) |
| 24 |
check_tidy_output(td) |
| 25 |
check_dims(td, 4, 7) |
| 26 |
}) |
| 27 |
|
| 28 |
test_that("glance.plm", { |
| 29 |
gl <- glance(fit) |
| 30 |
check_glance_outputs(gl) |
| 31 |
check_dims(gl, expected_cols = 7) |
| 32 |
}) |
| 33 |
|
| 34 |
test_that("augment.plm", { |
| 35 |
check_augment_function( |
| 36 |
aug = augment.plm, |
| 37 |
model = fit, |
| 38 |
data = Produc, |
| 39 |
newdata = Produc |
| 40 |
) |
| 41 |
}) |