Skip to content

Commit

Permalink
issue #1233
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentarelbundock committed Oct 18, 2024
1 parent eb7d002 commit 965f13e
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 3 deletions.
4 changes: 3 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: marginaleffects
Title: Predictions, Comparisons, Slopes, Marginal Means, and Hypothesis Tests
Version: 0.23.0
Version: 0.23.0.1
Authors@R:
c(person(given = "Vincent",
family = "Arel-Bundock",
Expand Down Expand Up @@ -157,6 +157,7 @@ Suggests:
survey,
survival,
svglite,
systemfit,
systemfonts,
tibble,
tictoc,
Expand Down Expand Up @@ -262,6 +263,7 @@ Collate:
'methods_stats.R'
'methods_survey.R'
'methods_survival.R'
'methods_systemfit.R'
'methods_tidymodels.R'
'methods_tobit1.R'
'modelarchive.R'
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ S3method(get_coef,polr)
S3method(get_coef,scam)
S3method(get_coef,selection)
S3method(get_coef,svyolr)
S3method(get_coef,systemfit)
S3method(get_coef,workflow)
S3method(get_group_names,bracl)
S3method(get_group_names,brmsfit)
Expand Down Expand Up @@ -109,6 +110,7 @@ S3method(get_vcov,orm)
S3method(get_vcov,pstpm2)
S3method(get_vcov,scam)
S3method(get_vcov,stpm2)
S3method(get_vcov,systemfit)
S3method(get_vcov,workflow)
S3method(glance,comparisons)
S3method(glance,hypotheses)
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# News

## Development

Bugs:

* `systemfit` models returned no standard errors when the same variables entered in different parts of the model. Thanks to @mronkko for report #1233.

## 0.23.0

Breaking change:
Expand Down
13 changes: 13 additions & 0 deletions R/methods_systemfit.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#' @rdname get_coef
#' @export
get_coef.systemfit <- function(model, ...) {
out <- stats::coef(model)
return(out)
}

#' @rdname get_vcov
#' @export
get_vcov.systemfit <- function(model, ...) {
out <- stats::vcov(model)
return(out)
}
22 changes: 22 additions & 0 deletions inst/tinytest/test-pkg-survfit.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
source("helpers.R")
using("marginaleffects")
requiet("systemfit")
requiet("MASS")

# issue #1233: duplicated coefficient names
set.seed(12345)
N <- 100
C <- matrix(c(1, .3, .3,
.3, 1, .3,
.3, .3, 1), 3, 3)
colnames(C) <- rownames(C) <- c("x1", "x2", "x3")
data <- as.data.frame(mvrnorm(N, rep(0, 3), C))
sys <- with(data, {
y1 <- 2 * x1 + 3 * x2 + x3 + 10 * rnorm(N)
m1 <- lm(y1 ~ x1 + x2 + x3)
y2 <- x1 + 3 * x2 + 2 * x3 + 10 * rnorm(N)
m2 <- lm(y2 ~ x1 + x2 + x3)
systemfit(list(formula(m1), formula(m2)), data = data)
})
h <- hypotheses(sys)
expect_false(anyNA(h$std.error))
5 changes: 4 additions & 1 deletion man/get_coef.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion man/get_vcov.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 965f13e

Please sign in to comment.