second_stage: Estimates the second of a sorting model

View source: R/second_stage.R

second_stageR Documentation

Estimates the second of a sorting model

Description

Estimates the second of a sorting model

Usage

second_stage(s1.results, data, endog = NULL, instr = NULL)

Arguments

s1.results

Indicates the (maxLik) object estimation results of the first stage of the sorting model

data

Dataset to be used

endog

Indicates the endogenous variable(s) to be instrumented (from the dataset in parentheses)

instr

indicates the intrument(s) for the endogenous variable

Details

This function estimates an OLS or an instrument variable. if an instrument variable procedure is needed both the instrument and the endogenous variables should be given

Value

An estimation object

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)

s2.results <- second_stage(s1.results, data)
s2.results <- second_stage(s1.results, data, "lnprice", phat$sorting_inst)


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