0
我需要估計xtoprobit
估計後的輸出。如果需要的話邊距預測結果誤差r(198)
但我有r(198)
當我運行,
margins, at(HealthStatus=(1(1)4)) predict(outcome(1))
運行後,
xtoprobit Ages HealthStatus ChildSex Family1 Family2 FatherPresent MotherPresent FatherEducation MotherEducation Location Income, iterate(0)
完整的語法:
set more off
local dir "/Users/user/Documents/STATISTICS/"
local datasave "Output/"
local slash "/"
********FLS1 & FLS2************
forvalues i=1/2 {
local p = "FLS`i'"
foreach j of local p {
if "`j'" == "FLS1" {
use `dir'`datasave'FLS`i'`slash'merge0, clear
}
else {
merge m:m pidlink using `dir'`datasave'FLS`i'`slash'merge0
keep if _merge==3
drop _merge
}
}
}
duplicates drop pidlink, force
drop hhid*
save `dir'`datasave'respFLS12, replace
forvalues i=1/2 {
use `dir'`datasave'respFLS12, clear
merge m:m pidlink using `dir'`datasave'FLS`i'`slash'merge_panel
keep if _merge==3
drop _merge hhid*
duplicates drop pidlink, force
gen year = `i'
save `dir'`datasave'FLS`i', replace
}
forvalues i=1/2 {
local p = "FLS`i'"
foreach j of local p {
if "`j'" == "FLS1" {
use `dir'`datasave'FLS`i', clear
}
else {
append using `dir'`datasave'FLS`i'
}
}
}
save `dir'`datasave'panel1, replace
********FLS3 & FLS4************
forvalues i=3/4 {
local p = "FLS`i'"
foreach j of local p {
if "`j'" == "FLS3" {
use `dir'`datasave'FLS`i'`slash'merge0, clear
}
else {
merge m:m pidlink using `dir'`datasave'FLS`i'`slash'merge0
keep if _merge==3
drop _merge
}
}
}
duplicates drop pidlink, force
drop hhid*
save `dir'`datasave'respFLS34, replace
forvalues i=3/4 {
use `dir'`datasave'respFLS34, clear
merge m:m pidlink using `dir'`datasave'FLS`i'`slash'merge_panel
keep if _merge==3
drop _merge hhid*
duplicates drop pidlink, force
gen year = `i'
save `dir'`datasave'FLS`i', replace
}
forvalues i=3/4 {
local p = "FLS`i'"
foreach j of local p {
if "`j'" == "FLS3" {
use `dir'`datasave'FLS`i', clear
}
else {
append using `dir'`datasave'FLS`i'
}
}
}
save `dir'`datasave'panel2, replace
**********************************
forvalues i=1/2 {
use `dir'`datasave'panel`i', clear
encode pidlink, gen(id)
duplicates report id year
duplicates drop id year, force
xtset id year
xtoprobit Ages HealthStatus ChildSex Family1 Family2 FatherPresent MotherPresent FatherEducation MotherEducation Location Income, iterate(0)
margins, at(HealthStatus=(1(1)4)) predict(outcome(1))
margins, at(HealthStatus=(1(1)4)) predict(outcome(2))
margins, at(HealthStatus=(1(1)4)) predict(outcome(3))
margins, at(HealthStatus=(1(1)4)) predict(outcome(4))
margins, at(ChildSex =(0(1)1)) predict(outcome(1))
margins, at(ChildSex =(0(1)1)) predict(outcome(2))
margins, at(ChildSex =(0(1)1)) predict(outcome(3))
margins, at(ChildSex =(0(1)1)) predict(outcome(4))
margins, at(FatherPresent =(0(1)1)) predict(outcome(1))
margins, at(FatherPresent =(0(1)1)) predict(outcome(2))
margins, at(FatherPresent =(0(1)1)) predict(outcome(3))
margins, at(FatherPresent =(0(1)1)) predict(outcome(4))
margins, at(MotherPresent =(0(1)1)) predict(outcome(1))
margins, at(MotherPresent =(0(1)1)) predict(outcome(2))
margins, at(MotherPresent =(0(1)1)) predict(outcome(3))
margins, at(MotherPresent =(0(1)1)) predict(outcome(4))
margins, at(FatherEducation =(1(1)6)) predict(outcome(1))
margins, at(FatherEducation =(1(1)6)) predict(outcome(2))
margins, at(FatherEducation =(1(1)6)) predict(outcome(3))
margins, at(FatherEducation =(1(1)6)) predict(outcome(4))
margins, at(MotherEducation =(1(1)6)) predict(outcome(1))
margins, at(MotherEducation =(1(1)6)) predict(outcome(2))
margins, at(MotherEducation =(1(1)6)) predict(outcome(3))
margins, at(MotherEducation =(1(1)6)) predict(outcome(4))
margins, at(Location =(0(1)1)) predict(outcome(1))
margins, at(Location =(0(1)1)) predict(outcome(2))
margins, at(Location =(0(1)1)) predict(outcome(3))
margins, at(Location =(0(1)1)) predict(outcome(4))
outreg2 using `dir'`datasave'panel`i', excel replace
save `dir'`datasave'panel`i', replace
}
1)編號同樣的錯誤。但是,謝謝你,升級到14.1後,它能正常工作 – asingh
你解決了這個問題很好。感謝報告。 –