Description Usage Arguments Author(s) Examples
View source: R/hyreg_function.R
Wrapper for xregControl and xreg to match the functionality of the STATA hyreg function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
formula |
a formula or list of formulas to be passed to xregControl and xreg. If a single formula is provided, the left side argument must match the dependent variable. If interval regression is intended, the upper and lower bounds should be assigned to two columns starting with a common name, e.g. value.lb and value.ub. For point estimates, these should be identical. |
df |
data.frame containing both the continuous and dichotomous data. Will be split into two data.frames using a column matching the name provided in the datatype argument. |
datatype |
character defining the column name separating dichotomous from continuous data. Continuous data should be interpretable as TRUE in as.logical, and dichotomous as FALSE |
init |
Optional named list or vector of numeric start values, to override those provided in the xregControl obects. Previously estimated xreg-objects can be used, in which case fitted values will be extracted. |
contdist |
character option to determine if the continuous model should use normal or logistic distribution. Options are "normal", and "logistic". "normal" instructs xregControl to provide cont_normal(), logistic provides cont_logistic(). Default is "normal". |
dichdist |
character option to determine if the dichotomous model should use normal or logistic distribution. Options are "normal", and "logistic". "normal" instructs xregControl to provide dich_normal(), logistic provides dich_logistic(). Default is "logistic". |
hetcont |
optional formula for fitting hetreoscedastic standard deviations for the continuous model. Parameters sharing names with the ones provided in the formula argument will be the same. If this is not intended, different parmaeter names are required. |
hetdich |
optional formula for fitting hetreoscedastic standard deviations for the dichotomous model. Requires dichotomous distributionn to be "normal". Parameters sharing names with the ones provided in the formula argument will be the same. If this is not intended, different parmaeter names are required. |
ul |
optional upper bound value for the dependent variable. Values over ul will be set to an interval between the observed and Inf, making the fitting similar to tobit regression. Defaults to Inf. |
ll |
optional lower bound value for the dependent variable. Values below ll will be set to an interval between the observed and -Inf, making the fitting similar to tobit regression. Defaults to -Inf. |
lntheta |
If TRUE, parameters or formulas for theta will be exponentiated using exp() prior to fitting, to match the default in the STATA hyreg command. Defaults to TRUE. |
lnsigma |
If TRUE, parameters or formulas for sigma will be exponentiated using exp() prior to fitting, to match the default in the STATA hyreg command. Defaults to TRUE. |
dichformula |
optional formula argument for the dichotomous dataset. If not provided, the formula for dichotomous data will be the same as for continuous. |
... |
optional arguments to be forwarded to xregControl, xreg, x_mle, or optim |
Kim Rand
1 2 3 4 | control_continuous <- xregControl(formulas = list(x ~ y * YVAR + z + ZVAR, value ~ INTERCEPT + x * XVAR), start_values = c(INTERCEPT = 0, XVAR = 1, YVAR = 1, ZVAR = 1), p_fun = cont_normal, name = "CONTINUOUS")
control_dichotomos <- xregControl(formulas = list(value ~ INTERCEPT2 + z * ZVAR), start_values = c(INTERCEPT2 = 0, ZVAR = 1), p_fun = dich_logistic, name = "DICHOTOMOUS")
joint_control <- c(control_continuous, control_dichotomous)
xreg(controlList = joint_control, dataList = list(CONTINUOUS = df1, DICHOTOMUS = df2))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.