sorting_inst: Calculates an instrument for an endogenous variable in a...

View source: R/sorting_inst.R

sorting_instR Documentation

Calculates an instrument for an endogenous variable in a sorting model setting

Description

Calculates an instrument for an endogenous variable in a sorting model setting

Usage

sorting_inst(
  s1.results,
  endog,
  data,
  n.iterations = 3,
  stepsize = 0.05,
  threshold = 5e-04
)

Arguments

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

Details

Instrument is calculated using a logit model estimation, assuming market clearing conditions given no unobserved heterogeneity between alternative choices (following Bayer et al. (2004))

Value

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

Examples

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")


Thdegraaff/sortingmod documentation built on March 15, 2023, 12:31 a.m.