Change some values of the exogenous variables in a data frame.
exogenous_fn(exogenous, newdata)
The function returns data frame which is similar to newdata
but some values of this data frame are set according to exogenous
.
list such that exogenous[[i]]
represents the value
(or a vector of values of the same size as nrow(newdata)
) which will
be exogenously assigned to the variable names(exogenous)[[i]]
in
newdata
i.e., newdata[, names(exogenous)[i]] <- exogenous[[i]]
.
If newdata
is NULL
and exogenous
is not NULL
then
newdata
is set to object$data
.
This argument is especially useful for causal inference when some endogenous
(dependent) variables should be exogenously assigned with some values i.e.,
in the right hand side of the formula
and formula2
.
The purpose of the exogeneous
argument is just a convenience
so
equivalently it is possible to exogenously provide the values to variables
via newdata
argument.
data frame.
This function changes exogenous
variables in newdata
.