Closed simonpcouch closed 4 days ago
Errors at the same place as #1216. No predictions from the mfx object, so augment_columns()
tries to use fitted()
.
library(broom)
library(mfx)
# simulate data
set.seed(12345)
n <- 1000
x <- rnorm(n)
# beta outcome
y_beta <- rbeta(n, shape1 = plogis(1 + 0.5 * x), shape2 = (abs(0.2 * x)))
y_beta <- (y_beta * (n - 1) + 0.5) / n # Smithson and Verkuilen correction
df <- data.frame(y_beta, x)
fit_betamfx <- betamfx(y_beta ~ x | x, data = df)
augment(fit_betamfx, head(df))
#> Error in data.frame(..., check.names = FALSE): arguments imply differing number of rows: 6, 1000
predict(fit_betamfx, head(df))
#> Error in UseMethod("predict"): no applicable method for 'predict' applied to an object of class "betamfx"
Created on 2024-09-26 with reprex v2.1.1
No mfx update in the last 5 years, so not due to any changes there.
Actually first surfaced here:
These tidiers dispatch directly to augment.betareg()
, so this is quite related to #1216.
augment_columns()
is receiving several type.predict()
values, resulting in:
predict(model, newdata = newdata, type = c("response", "link"))
#> Error in match.arg(type, c("response", "link", "precision", "variance", :
#> 'arg' must be of length 1