tests/testthat/test-other-scam-methods.R

## Test other scam methods

## load packages
library("testthat")

test_that("vcov.scam works", {
    V <- vcov(sw)
    expect_identical(dim(V), c(5L, 5L))
    V <- vcov(sw, dispersion = 2)
    expect_identical(dim(V), c(5L, 5L))
    V <- vcov(sw, freq = TRUE)
    expect_identical(dim(V), c(5L, 5L))
    V <- vcov(sw, freq = TRUE, parametrized = TRUE)
    expect_identical(dim(V), c(5L, 5L))
    V <- vcov(sw, freq = TRUE, parametrized = FALSE)
    expect_identical(dim(V), c(5L, 5L))
    V <- vcov(sw, freq = FALSE, parametrized = FALSE)
    expect_identical(dim(V), c(5L, 5L))
})

test_that("coef.scam works", {
    beta <- coef(sw)
    expect_identical(length(beta), 5L)
    beta <- coef(sw, parametrized = FALSE)
    expect_identical(length(beta), 5L)
})

Try the gratia package in your browser

Any scripts or data that you put into this service are public.

gratia documentation built on Feb. 16, 2023, 10:40 p.m.