Skip to content

Commit

Permalink
Merge aab3c6f into d6f36f8
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Mar 18, 2023
2 parents d6f36f8 + aab3c6f commit 6c90722
Show file tree
Hide file tree
Showing 23 changed files with 575 additions and 82 deletions.
20 changes: 20 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ S3method(find_formula,feglm)
S3method(find_formula,feis)
S3method(find_formula,felm)
S3method(find_formula,fixest)
S3method(find_formula,fixest_multi)
S3method(find_formula,gam)
S3method(find_formula,gamlss)
S3method(find_formula,gamm)
Expand Down Expand Up @@ -180,6 +181,8 @@ S3method(find_formula,wbm)
S3method(find_formula,zcpglm)
S3method(find_formula,zeroinfl)
S3method(find_formula,zerotrunc)
S3method(find_offset,default)
S3method(find_offset,fixest_multi)
S3method(find_parameters,BBmm)
S3method(find_parameters,BBreg)
S3method(find_parameters,BFBayesFactor)
Expand Down Expand Up @@ -222,6 +225,7 @@ S3method(find_parameters,default)
S3method(find_parameters,deltaMethod)
S3method(find_parameters,emmGrid)
S3method(find_parameters,emm_list)
S3method(find_parameters,fixest_multi)
S3method(find_parameters,flexsurvreg)
S3method(find_parameters,gam)
S3method(find_parameters,gamlss)
Expand Down Expand Up @@ -308,23 +312,30 @@ S3method(find_predictors,afex_aov)
S3method(find_predictors,bfsl)
S3method(find_predictors,default)
S3method(find_predictors,fixest)
S3method(find_predictors,fixest_multi)
S3method(find_predictors,logitr)
S3method(find_predictors,selection)
S3method(find_random,afex_aov)
S3method(find_random,default)
S3method(find_response,bfsl)
S3method(find_response,default)
S3method(find_response,fixest_multi)
S3method(find_response,joint)
S3method(find_response,logitr)
S3method(find_response,mediate)
S3method(find_response,mjoint)
S3method(find_response,model_fit)
S3method(find_response,selection)
S3method(find_statistic,default)
S3method(find_statistic,fixest_multi)
S3method(find_terms,afex_aov)
S3method(find_terms,aovlist)
S3method(find_terms,bfsl)
S3method(find_terms,default)
S3method(find_terms,fixest_multi)
S3method(find_terms,mipo)
S3method(find_variables,default)
S3method(find_variables,fixest_multi)
S3method(find_weights,brmsfit)
S3method(find_weights,default)
S3method(find_weights,gls)
Expand Down Expand Up @@ -488,6 +499,7 @@ S3method(get_df,default)
S3method(get_df,emmGrid)
S3method(get_df,emm_list)
S3method(get_df,fixest)
S3method(get_df,fixest_multi)
S3method(get_df,lme)
S3method(get_df,lmerMod)
S3method(get_df,lmerModTest)
Expand Down Expand Up @@ -593,6 +605,7 @@ S3method(get_parameters,deltaMethod)
S3method(get_parameters,emmGrid)
S3method(get_parameters,emm_list)
S3method(get_parameters,epi.2by2)
S3method(get_parameters,fixest_multi)
S3method(get_parameters,flexsurvreg)
S3method(get_parameters,gam)
S3method(get_parameters,gamlss)
Expand Down Expand Up @@ -694,6 +707,7 @@ S3method(get_predicted,default)
S3method(get_predicted,fa)
S3method(get_predicted,faMain)
S3method(get_predicted,fixest)
S3method(get_predicted,fixest_multi)
S3method(get_predicted,gam)
S3method(get_predicted,gamlss)
S3method(get_predicted,gamm)
Expand Down Expand Up @@ -791,6 +805,7 @@ S3method(get_statistic,epi.2by2)
S3method(get_statistic,ergm)
S3method(get_statistic,feis)
S3method(get_statistic,fixest)
S3method(get_statistic,fixest_multi)
S3method(get_statistic,flac)
S3method(get_statistic,flexsurvreg)
S3method(get_statistic,flic)
Expand Down Expand Up @@ -913,6 +928,7 @@ S3method(get_varcov,crr)
S3method(get_varcov,default)
S3method(get_varcov,feis)
S3method(get_varcov,fixest)
S3method(get_varcov,fixest_multi)
S3method(get_varcov,flac)
S3method(get_varcov,flexsurvreg)
S3method(get_varcov,flic)
Expand Down Expand Up @@ -1034,6 +1050,7 @@ S3method(link_function,feglm)
S3method(link_function,feis)
S3method(link_function,felm)
S3method(link_function,fixest)
S3method(link_function,fixest_multi)
S3method(link_function,flac)
S3method(link_function,flexsurvreg)
S3method(link_function,flic)
Expand Down Expand Up @@ -1151,6 +1168,7 @@ S3method(link_inverse,feglm)
S3method(link_inverse,feis)
S3method(link_inverse,felm)
S3method(link_inverse,fixest)
S3method(link_inverse,fixest_multi)
S3method(link_inverse,flac)
S3method(link_inverse,flexsurvreg)
S3method(link_inverse,flic)
Expand Down Expand Up @@ -1281,6 +1299,7 @@ S3method(model_info,feglm)
S3method(model_info,feis)
S3method(model_info,felm)
S3method(model_info,fixest)
S3method(model_info,fixest_multi)
S3method(model_info,flac)
S3method(model_info,flexsurvreg)
S3method(model_info,flic)
Expand Down Expand Up @@ -1418,6 +1437,7 @@ S3method(n_obs,feglm)
S3method(n_obs,feis)
S3method(n_obs,felm)
S3method(n_obs,fixest)
S3method(n_obs,fixest_multi)
S3method(n_obs,flexsurvreg)
S3method(n_obs,gam)
S3method(n_obs,gamm)
Expand Down
5 changes: 5 additions & 0 deletions R/find_formula.R
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,11 @@ find_formula.fixest <- function(x, verbose = TRUE, ...) {
.find_formula_return(f, verbose = verbose)
}

#' @export
find_formula.fixest_multi <- function(x, verbose = TRUE, ...) {
lapply(x, find_formula.fixest, verbose, ...)
}



#' @export
Expand Down
10 changes: 10 additions & 0 deletions R/find_offset.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
#' }
#' @export
find_offset <- function(x) {
UseMethod("find_offset")
}

#' @export
find_offset.default <- function(x) {
terms <- .safe(
as.character(attributes(stats::terms(find_formula(x)[[1]]))$variables),
find_terms(x)
Expand Down Expand Up @@ -62,3 +67,8 @@ find_offset <- function(x) {
return(NULL)
}
}

#' @export
find_offset.fixest_multi <- function(x) {
lapply(x, find_offset.default)

Check warning on line 73 in R/find_offset.R

View check run for this annotation

Codecov / codecov/patch

R/find_offset.R#L73

Added line #L73 was not covered by tests
}
10 changes: 10 additions & 0 deletions R/find_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,16 @@ find_parameters.nls <- function(x,
}
}

#' @export
find_parameters.fixest_multi <- function(x,
component = c("all", "conditional", "nonlinear"),
flatten = FALSE,
...) {
lapply(x, find_parameters.default, component = component, flatten = flatten, ...)
}



# helper ----------------------------

.filter_parameters <- function(l, effects, component = "all", flatten, recursive = TRUE) {
Expand Down
6 changes: 6 additions & 0 deletions R/find_predictors.R
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,12 @@ find_predictors.fixest <- function(x, flatten = FALSE, ...) {
}


#' @export
find_predictors.fixest_multi <- function(x, flatten = FALSE, ...) {
lapply(x, find_predictors.fixest, flatten, ...)
}


#' @export
find_predictors.bfsl <- function(x, flatten = FALSE, verbose = TRUE, ...) {
l <- list(conditional = "x")
Expand Down
9 changes: 9 additions & 0 deletions R/find_response.R
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,15 @@ find_response.joint <- function(x,
}


#' @export
find_response.fixest_multi <- function(x,
combine = TRUE,
component = c("conditional", "survival", "all"),
...) {
lapply(x, find_response.default, combine, component, ...)
}




# utils ---------------------
Expand Down
10 changes: 9 additions & 1 deletion R/find_statistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
#' find_statistic(m)
#' @export
find_statistic <- function(x, ...) {
UseMethod("find_statistic")
}

#' @export
find_statistic.default <- function(x, ...) {
# model object check --------------------------------------------------------

# check if the object is a model object; if not, quit early
Expand Down Expand Up @@ -339,7 +344,10 @@ find_statistic <- function(x, ...) {
}
}


#' @export
find_statistic.fixest_multi <- function(x, ...) {
lapply(x, find_statistic.default, ...)
}



Expand Down
5 changes: 5 additions & 0 deletions R/find_terms.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,11 @@ find_terms.bfsl <- function(x, flatten = FALSE, verbose = TRUE, ...) {
}
}

#' @export
find_terms.fixest_multi <- function(x, flatten = FALSE, verbose = TRUE, ...) {
lapply(x, find_terms.default, flatten, verbose)
}


# unsupported ------------------

Expand Down
18 changes: 18 additions & 0 deletions R/find_variables.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,15 @@ find_variables <- function(x,
component = "all",
flatten = FALSE,
verbose = TRUE) {
UseMethod("find_variables")
}

#' @export
find_variables.default <- function(x,
effects = "all",
component = "all",
flatten = FALSE,
verbose = TRUE) {
effects <- match.arg(effects, choices = c("all", "fixed", "random"))
component <- match.arg(component, choices = c("all", "conditional", "zi", "zero_inflated", "dispersion", "instruments", "smooth_terms"))

Expand All @@ -84,3 +93,12 @@ find_variables <- function(x,
c(list(response = resp), pr)
}
}

#' @export
find_variables.fixest_multi <- function(x,
effects = "all",
component = "all",
flatten = FALSE,
verbose = TRUE) {
lapply(x, find_variables.default, effects, component, flatten, verbose)
}
5 changes: 5 additions & 0 deletions R/get_df.R
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ get_df.fixest <- function(x, type = "residual", ...) {
fixest::degrees_freedom(x, type = type)
}

#' @export
get_df.fixest_multi <- function(x, type = "residual", ...) {
lapply(x, get_df.fixest, type, ...)

Check warning on line 249 in R/get_df.R

View check run for this annotation

Codecov / codecov/patch

R/get_df.R#L249

Added line #L249 was not covered by tests
}



# Mixed models - special treatment --------------
Expand Down
5 changes: 5 additions & 0 deletions R/get_df_residual.r
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,11 @@
fixest::degrees_freedom(x, type = "resid")
}

#' @keywords internal
.degrees_of_freedom_residual.fixest_multi <- function(x, verbose = TRUE, ...) {
lapply(x, .degrees_of_freedom_residual.fixest, verbose, ...)

Check warning on line 96 in R/get_df_residual.r

View check run for this annotation

Codecov / codecov/patch

R/get_df_residual.r#L96

Added line #L96 was not covered by tests
}

#' @keywords internal
.degrees_of_freedom_residual.summary.lm <- function(x, verbose = TRUE, ...) {
x$fstatistic[3]
Expand Down
5 changes: 4 additions & 1 deletion R/get_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,10 @@ get_parameters.pgmm <- function(x, component = c("conditional", "all"), ...) {
text_remove_backticks(params)
}


#' @export
get_parameters.fixest_multi <- function(x, component = c("conditional", "all"), ...) {
lapply(x, get_parameters.default, component, ...)
}


# utility functions ---------------------------------
Expand Down
5 changes: 5 additions & 0 deletions R/get_predicted_fixedeffects.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,8 @@ get_predicted.fixest <- function(x, predict = "expectation", data = NULL, ...) {

.get_predicted_out(predictions, args = args, ci_data = NULL)
}

#' @export
get_predicted.fixest_multi <- function(x, predict = "expectation", data = NULL, ...) {
lapply(x, get_predicted.fixest, predict, data, ...)

Check warning on line 42 in R/get_predicted_fixedeffects.R

View check run for this annotation

Codecov / codecov/patch

R/get_predicted_fixedeffects.R#L42

Added line #L42 was not covered by tests
}
5 changes: 5 additions & 0 deletions R/get_statistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -2030,6 +2030,11 @@ get_statistic.fixest <- function(x, ...) {
out
}

#' @export
get_statistic.fixest_multi <- function(x, ...) {
lapply(x, get_statistic.fixest, ...)
}



#' @export
Expand Down
8 changes: 8 additions & 0 deletions R/get_varcov.R
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ get_varcov.fixest <- function(x,
do.call("FUN", args)
}

#' @export
get_varcov.fixest_multi <- function(x,
vcov = NULL,
vcov_args = NULL,
...) {
lapply(x, get_varcov.fixest, vcov, vcov_args, ...)
}



# mlm ---------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion R/is_model.R
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ is_regression_model <- function(x) {

# f --------------------
"feglm", "feis", "felm", "fitdistr", "fixest", "flexmix",
"flexsurvreg", "flac", "flic",
"flexsurvreg", "flac", "flic", "fixest_multi",

# g --------------------
"gam", "Gam", "GAMBoost", "gamlr", "gamlss", "gamm", "gamm4",
Expand Down
3 changes: 2 additions & 1 deletion R/is_model_supported.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ supported_models <- function() {
"eglm", "elm", "epi.2by2", "ergm",

# f ----------------------------
"feis", "felm", "feglm", "fitdistr", "fixest", "flexsurvreg", "flac", "flic",
"feis", "felm", "feglm", "fitdistr", "fixest", "flexsurvreg", "flac",
"flic", "fixest_multi",

# g ----------------------------
"gam", "Gam", "gamlss", "gamm", "gamm4", "garch", "gbm", "gee", "geeglm",
Expand Down
5 changes: 5 additions & 0 deletions R/link_function.R
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,11 @@ link_function.fixest <- function(x, ...) {
#' @export
link_function.feglm <- link_function.fixest

#' @export
link_function.fixest_multi <- function(x, ...) {
lapply(x, link_function.fixest, ...)

Check warning on line 468 in R/link_function.R

View check run for this annotation

Codecov / codecov/patch

R/link_function.R#L468

Added line #L468 was not covered by tests
}


#' @export
link_function.glmx <- function(x, ...) {
Expand Down
4 changes: 4 additions & 0 deletions R/link_inverse.R
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,10 @@ link_inverse.fixest <- function(x, ...) {
#' @export
link_inverse.feglm <- link_inverse.fixest

#' @export
link_inverse.fixest_multi <- function(x, ...) {
lapply(x, link_inverse.fixest, ...)

Check warning on line 459 in R/link_inverse.R

View check run for this annotation

Codecov / codecov/patch

R/link_inverse.R#L459

Added line #L459 was not covered by tests
}

#' @export
link_inverse.glmx <- function(x, ...) {
Expand Down

0 comments on commit 6c90722

Please sign in to comment.