Skip to content

Commit 34e7a0a

Browse files
authored
Update test-acro_glm.R
Signed-off-by: Jessica Ikechukwu <Jessica.Ikechukwu@uwe.ac.uk>
1 parent ac5b9bf commit 34e7a0a

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

tests/testthat/test-acro_glm.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ nursery_data$recommend[which(nursery_data$recommend == "very_recom")] <- "2"
55
nursery_data$recommend[which(nursery_data$recommend == "priority")] <- "3"
66
nursery_data$recommend[which(nursery_data$recommend == "spec_prior")] <- "4"
77
nursery_data$recommend <- as.numeric(nursery_data$recommend)
8+
89
# extract relevant columns
910
df <- nursery_data[, c("finance", "children")]
1011
# drop rows with missing values
@@ -15,22 +16,26 @@ df <- transform(df, finance = as.numeric(finance))
1516
df$finance <- df$finance - 1
1617
# formula to fit
1718
formula <- "finance ~ children"
19+
1820
test_that("acro_glm without initialising ACRO object first", {
1921
acroEnv$ac <- NULL
2022
expect_error(acro_glm(formula = formula, data = df, family = "probit"), "ACRO has not been initialised. Please first call acro_init()")
2123
})
24+
2225
test_that("acro_glm with probit as a family works", {
2326
testthat::skip_on_cran()
2427
acro_init()
2528
model <- acro_glm(formula = formula, data = df, family = "probit")
2629
expect_s3_class(model, "statsmodels.iolib.summary.Summary")
2730
})
31+
2832
test_that("acro_glm with logit as a family works", {
2933
testthat::skip_on_cran()
3034
acro_init()
3135
model <- acro_glm(formula = formula, data = df, family = "logit")
3236
expect_s3_class(model, "statsmodels.iolib.summary.Summary")
3337
})
38+
3439
test_that("acro_glm through an error if the family is not recognised", {
3540
testthat::skip_on_cran()
3641
acro_init()

0 commit comments

Comments
 (0)