sorting_inst | R Documentation |
Calculates an instrument for an endogenous variable in a sorting model setting
sorting_inst( s1.results, endog, data, n.iterations = 3, stepsize = 0.05, threshold = 5e-04 )
s1.results |
Indicates the (maxLik) object estimation results of the first stage of the sorting model |
endog |
Indicates the endogenous variable to be instrumented |
data |
Dataset to be used |
n.iterations |
Indicates the number of iterations |
stepsize |
Indicates the contraction-mapping scaling coefficient |
threshold |
Indicates the convergence threshold |
Instrument is calculated using a logit model estimation, assuming market clearing conditions given no unobserved heterogeneity between alternative choices (following Bayer et al. (2004))
A list containing (1) Results of the IV estimation, with the computed vector as instrument for the endogenous variable. (2) a vector of the computed instrument, (3) the correlation between the computed instrument and the original variable, and (4) the vector of the endogenous variable
data <- municipality s1.results <- first_stage(code_name = "mun_code", X_names = c("lnprice","kindergardens_1km","p_mig_west", "nature","monuments","cafes_1km"), Z_names = c("income","double_earner_hh","hh_kids","age", "migskill"), data = data, print_detail = 1) endog <- ("lnprice") phat <- sorting_inst(s1.results, "lnprice", data, stepsize = 0.02) plot(phat$sorting_inst, phat$endogenous, xlab="Instrument", ylab="Endogeneous variable")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.