Estimates the first stage of a sorting model

first_stage(code_name, Z_names, X_names, data, print_detail = 3)

Arguments

code_name

Indicates (with name or column number) the vector with alternative chosen

Z_names

Indicates (with names or column numbers) the vectors with individual data

X_names

Indicates (with names or column numbers) the vectors with alternative data

data

Dataset to be used

print_detail

Controls the output detail of maxLik (default is set at 3)

Value

A (maxLik) object with the estimates (maxLik) together with the indicators of the alternative chosen, the vectors with individual data, the vectors with city/regional data and the name of the reference alternative

Details

Optimization occurs via the maxLik package for an obtimization of a conditional logit model

Examples

code_name <- c("mun_code") Z_names <- c("age","income") X_names <- c("lnprice","nature","monuments") data <- municipality s1.results <- first_stage(code_name, Z_names, X_names, data, print_detail = 1)
#> -------------- #> successive function values within tolerance limit #> 9 iterations #> estimate: -0.5666734 -2.724077 -2.392861 -3.131786 -2.574547 -3.573678 -1.688019 -1.949442 -2.957492 -2.808079 -4.832786 -2.581096 -1.913211 0.4822275 -1.493707 -3.122563 -2.681831 -2.257635 -1.894437 -1.436975 -2.428922 -0.3336451 0.706221 -4.832498 -4.130145 -2.04856 -3.486449 -3.817549 -1.899705 -2.306605 -2.844025 -2.381185 -0.6401074 -3.44724 -0.6828241 -2.444763 -2.48806 -1.379281 -2.176586 -3.380877 -3.554658 -3.926541 -2.473659 -3.389041 -3.616566 -1.146581 -3.438195 -2.477318 -1.566623 -2.744272 -2.783615 -4.134242 -0.1569915 -2.742123 -1.372191 -1.758573 -2.960134 -2.815212 -3.212986 -1.666371 -0.1350025 -3.722707 -0.6460606 -3.580425 -2.473809 0.07688276 1.062669 -3.436433 -1.964224 -2.152407 -2.705171 -0.08087923 -2.268713 -2.807943 -1.08457 -2.271171 -2.5254 -0.112507 -3.043473 -3.318632 -2.575029 -3.907236 -2.915444 -3.136453 -2.398573 -3.122973 -2.427277 -2.260578 -3.030384 -3.11987 -2.361661 -2.337455 0.4878886 -0.06379992 -1.219543 -3.033777 -2.625059 -3.117607 -1.507619 -3.031873 -2.897292 -2.876107 -2.380178 1.422815 -3.440163 -2.179958 -2.230552 -0.407009 -1.564999 0.05530238 -4.158588 -1.877553 -3.031959 -4.129617 -3.031226 -3.724715 -3.908802 -3.727143 -2.150232 -2.953152 -3.121085 0.1621805 -1.718289 -1.676989 -3.031553 -2.521091 0.02814527 0.206205 -2.522594 -1.564463 -2.149817 -1.778713 -0.004643133 0.2985015 0.04522828 0.4500525 0.03115685 -0.1760169 -0.004068389 -0.0279477 #> Function value: -38750.99