File: test-tobit.R

package info (click to toggle)
r-cran-parameters 0.24.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,852 kB
  • sloc: sh: 16; makefile: 2
file content (38 lines) | stat: -rw-r--r-- 820 bytes parent folder | download
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
35
36
37
38
skip_if_not_installed("AER")
data("Affairs", package = "AER")
m1 <- AER::tobit(
  affairs ~ age + yearsmarried + religiousness + occupation + rating,
  data = Affairs
)

test_that("ci", {
  expect_equal(
    ci(m1)$CI_low,
    c(2.80106, -0.33435, 0.29049, -2.47756, -0.17261, -3.0843),
    tolerance = 1e-4
  )
})

test_that("se", {
  expect_equal(
    standard_error(m1)$SE,
    c(2.74145, 0.07909, 0.13452, 0.40375, 0.25442, 0.40783),
    tolerance = 1e-4
  )
})

test_that("p_value", {
  expect_equal(
    p_value(m1)$p,
    c(0.00287, 0.02337, 4e-05, 3e-05, 0.20001, 0),
    tolerance = 1e-4
  )
})

test_that("model_parameters", {
  expect_equal(
    model_parameters(m1)$Coefficient,
    c(8.1742, -0.17933, 0.55414, -1.68622, 0.32605, -2.28497),
    tolerance = 1e-4
  )
})