Skip to content

Commit 8ccff8b

Browse files
[Feature] get_simulated (#1172)
* initial * address comments * rename vars * address comments * fix * address comments * fix Gemini instructions * address comments * add glm test * minor code style * stop on categorical outcomes * code readability * fix for binomial and data grid * works for cbind-glm * add tests * test * code readability * add comment * code readability * make filtering work for glmmTMB * fix * namespace * news, desc * pkgdown * code readability, aggregate by mode * support Gamma and Poisson * refactor, add helpers for other families * fix,add tests * fix * fixes * don't return data by default, but add option to include * data cannot be null, fixes * fixes, tests * fix, add tests * don't need docs for mehtods without new arguments * docs * add test * add tests * test * typo * typo * fix * fix * add inclide_data for merMod * check methods * first mgcv::gam draft * ... * more gam families * add beta fam --------- Co-authored-by: Daniel <mail@danielluedecke.de>
1 parent 6b4c64c commit 8ccff8b

File tree

9 files changed

+1324
-2
lines changed

9 files changed

+1324
-2
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: insight
33
Title: Easy Access to Model Information for Various Model Objects
4-
Version: 1.4.6.10
4+
Version: 1.4.6.11
55
Authors@R:
66
c(person(given = "Daniel",
77
family = "Lüdecke",

NAMESPACE

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -924,6 +924,47 @@ S3method(get_response,DirichletRegModel)
924924
S3method(get_response,bfsl)
925925
S3method(get_response,default)
926926
S3method(get_response,nestedLogit)
927+
S3method(get_simulated,Gam)
928+
S3method(get_simulated,MixMod)
929+
S3method(get_simulated,afex_aov)
930+
S3method(get_simulated,betareg)
931+
S3method(get_simulated,bife)
932+
S3method(get_simulated,bracl)
933+
S3method(get_simulated,brmsfit)
934+
S3method(get_simulated,clm)
935+
S3method(get_simulated,coxme)
936+
S3method(get_simulated,coxph)
937+
S3method(get_simulated,crr)
938+
S3method(get_simulated,data.frame)
939+
S3method(get_simulated,default)
940+
S3method(get_simulated,fa)
941+
S3method(get_simulated,faMain)
942+
S3method(get_simulated,fixest)
943+
S3method(get_simulated,gam)
944+
S3method(get_simulated,gamlss)
945+
S3method(get_simulated,gamm)
946+
S3method(get_simulated,glm)
947+
S3method(get_simulated,glmgee)
948+
S3method(get_simulated,glmmTMB)
949+
S3method(get_simulated,hglm)
950+
S3method(get_simulated,htest)
951+
S3method(get_simulated,hurdle)
952+
S3method(get_simulated,list)
953+
S3method(get_simulated,lm)
954+
S3method(get_simulated,lmerMod)
955+
S3method(get_simulated,lrm)
956+
S3method(get_simulated,merMod)
957+
S3method(get_simulated,multinom)
958+
S3method(get_simulated,phylolm)
959+
S3method(get_simulated,polr)
960+
S3method(get_simulated,prcomp)
961+
S3method(get_simulated,principal)
962+
S3method(get_simulated,rlm)
963+
S3method(get_simulated,rma)
964+
S3method(get_simulated,sdmTMB)
965+
S3method(get_simulated,stanreg)
966+
S3method(get_simulated,survreg)
967+
S3method(get_simulated,zeroinfl)
927968
S3method(get_statistic,Arima)
928969
S3method(get_statistic,BBmm)
929970
S3method(get_statistic,DirichletRegModel)
@@ -1915,6 +1956,7 @@ export(get_random)
19151956
export(get_residuals)
19161957
export(get_response)
19171958
export(get_sigma)
1959+
export(get_simulated)
19181960
export(get_statistic)
19191961
export(get_transformation)
19201962
export(get_varcov)

NEWS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22

33
## Changes
44

5+
* New function, `get_simulated()`, to return simulated values from the response
6+
of regression models, which is comparable to posterior predictions from a
7+
model.
8+
9+
* Improved performance of `find_parameters()` for models from package *mgcv*
10+
that include random effects.
11+
512
* Improved performance of `find_parameters()` and `get_statistic()` for models
613
from package *mgcv* that include random effects.
714

R/get_datagrid.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1356,7 +1356,8 @@ get_datagrid.comparisons <- get_datagrid.slopes
13561356

13571357

13581358
#' @keywords internal
1359-
.mode_value <- function(x) {
1359+
.mode_value <- function(x, na.rm = TRUE) {
1360+
# na.rm = TRUE not used, only required for "get_simulated.glmmTMB()"
13601361
uniqv <- unique(x)
13611362
tab <- tabulate(match(x, uniqv))
13621363
idx <- which.max(tab)

0 commit comments

Comments
 (0)