Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,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 @@ -181,6 +182,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 @@ -223,6 +226,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 @@ -310,23 +314,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 @@ -493,6 +504,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 @@ -602,6 +614,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 @@ -704,6 +717,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 @@ -802,6 +816,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 @@ -927,6 +942,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 @@ -1049,6 +1065,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 @@ -1168,6 +1185,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 @@ -1301,6 +1319,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 @@ -1441,6 +1460,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)
}
10 changes: 10 additions & 0 deletions R/find_parameters.R
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,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 @@ -150,6 +150,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 @@ -260,6 +260,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, ...)
}



# 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 @@ -89,6 +89,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, ...)
}

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

#' @export
get_parameters.fixest_multi <- function(x, component = c("conditional", "all"), ...) {
out <- lapply(x, get_parameters.default, component, ...)
resp <- find_response(x)
for (i in seq_along(out)) {
out[[i]]$Response <- resp[[i]]
}

# bind lists together to one data frame, save attributes
att <- attributes(out[[1]])
params <- do.call(rbind, out)
row.names(params) <- NULL

attributes(params) <- utils::modifyList(att, attributes(params))
params
}


# utility functions ---------------------------------
Expand Down
22 changes: 22 additions & 0 deletions R/get_predicted_fixedeffects.R
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,25 @@ 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, ...) {
out <- lapply(x, function(y) {
as.data.frame(
get_predicted.fixest(y, predict, data, ...)
)
})

resp <- find_response(x)
for (i in seq_along(out)) {
out[[i]]$Response <- resp[[i]]
}

# bind lists together to one data frame, save attributes
att <- attributes(out[[1]])
params <- do.call(rbind, out)
row.names(params) <- NULL

attributes(params) <- utils::modifyList(att, attributes(params))
params
}
5 changes: 5 additions & 0 deletions R/get_statistic.R
Original file line number Diff line number Diff line change
Expand Up @@ -2110,6 +2110,11 @@ get_statistic.fixest <- function(x, ...) {
out
}

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



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

#' @export
get_varcov.fixest_multi <- function(x,
vcov = NULL,
vcov_args = NULL,
...) {
out <- lapply(x, get_varcov.fixest, vcov, vcov_args, ...)
resp <- find_response(x)
for (i in seq_along(out)) {
rownames(out[[i]]) <- paste0(resp[[i]], ":", rownames(out[[i]]))
colnames(out[[i]]) <- paste0(resp[[i]], ":", colnames(out[[i]]))
}
print(out)

# bind lists together to one data frame, save attributes
att <- attributes(out[[1]])
params <- do.call(rbind, out)
row.names(params) <- NULL

attributes(params) <- utils::modifyList(att, attributes(params))
params
}



# 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
Loading