Skip to content

Commit

Permalink
added unit test for issue #56 for environment evaluation issues for M…
Browse files Browse the repository at this point in the history
…PM models
  • Loading branch information
merliseclyde committed Nov 8, 2022
1 parent e10ce87 commit d33f2bf
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/testthat/test-bas-lm.R
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,29 @@ test_that("as.matrix tools", {
})


# GitHub issue #56 and #42

test_that("formula and env issues with MPM",{
data(UScrime, package = "MASS")
UScrime <- UScrime[, 1:5]

crime.bic1 <- bas.lm(formula = M ~ So + Ed + Po1 + Po2,
data = UScrime,
prior = "JZS",
initprobs = c(1, 0.5, 0.5, 0.5, 0.5),
renormalize = TRUE)
coef.mpm1 <- coef(crime.bic1, estimator = "MPM")

form <- M ~ So + Ed + Po1 + Po2
crime.bic2 <- BAS::bas.lm(formula = form,
data = UScrime,
prior = "JZS",
initprobs = c(1, 0.5, 0.5, 0.5, 0.5),
renormalize = TRUE)

expect_error(coef.mpm2 = coef(crime.bic2, estimator = "MPM"))
# expect_equal(coef.mpm1, coef.mpm2)
}
)


0 comments on commit d33f2bf

Please sign in to comment.