| glmm_marginal | R Documentation |
Marginal effect from a binomial-logit or Poisson-log GLMM
glmm_marginal(
X,
beta,
M,
family,
x,
at = character(0),
atvals = numeric(0),
atmeans = character(0),
average = character(0),
re_type = c("AtZero", "AtEstimated", "At", "Average"),
type = c("DyDx", "Diff", "Ratio"),
xvals = c(0, 1),
Zu = NULL,
zu_samples = NULL,
has_intercept = TRUE
)
X |
n x P design matrix. Must have column names. |
beta |
length-P fitted coefficient vector. |
M |
P x P variance-covariance matrix of beta (caller chooses model-based / sandwich / KR etc.). |
family |
"binomial" (logit) or "poisson" (log). |
x |
Name (character) or index (integer) of the column whose marginal effect we want. |
at |
Character vector of column names to fix at user values. |
atvals |
Numeric vector matching 'at'. |
atmeans |
Character vector of column names to fix at column mean. |
average |
Character vector of column names to average over (their empirical distribution in X is preserved). |
re_type |
Random-effect treatment: "At" - fix Zu at user value(s) via 'Zu' "AtEstimated" - posterior-mean Zu = rowMeans(zu_samples) "AtZero" - Zu = 0 "Average" - integrate over MCMC draws in zu_samples |
type |
"DyDx", "Diff", or "Ratio". |
xvals |
Length-2 numeric. DyDx is evaluated at xvals[1]; Diff and Ratio compare xvals[1] vs xvals[2]. |
Zu |
Used only when re_type = "At". Either a single scalar (when no covariates are averaged) or a length-n vector of pre-computed Z u values (when 'average' is non-empty or only x is named with re_type Average/AtEstimated). |
zu_samples |
n x iter matrix of MCMC draws of Zu. Required for re_type = "Average" or "AtEstimated". |
has_intercept |
TRUE if the first / an intercept column is in X and should not be counted among "named" variables. Used only for the 'at' + 'atmeans' + 'average' + 1 == P - int consistency check. |
list with elements 'estimate', 'se', plus the input choices.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.