全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
637 1
2023-04-27
使用负二项回归的时候,报错说jh_diverall ambiguous abbreviation
回归命令为:
foreach year in 2019 {
                  foreach period in all wd wk {
                 local commonvars "nonlocal100 SubwayNum BusStopSum Bar InternetBar PoliceStation GeneralHospital Clothes_Necessities Shoppingmall_Mansion ConvenientStore IntegreatedMarket WholesaleMarket Banks Supermarkets"
         local incomerate "`period'ratetotalambr12100 `period'ratetotalambr4100 `period'ratetotalambr5100 `period'ratetotalambr678100"
                 
      asdoc nbreg `period'theft`year'all  dz_diver`period'  dz_`period'totalambk   jh_diver`period'`income'   jh_diver`period'ambk  `incomerate'   `commonvars' , irr nolog setstars(*@.001, **@.01, ***@.05)
       
      estimates store M`period'`year'total
}
}

经排查,删去jh_diver`period'`income' 变量时,模型可以正常跑

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2023-4-27 22:48:16
已解决,生成一个新变量替代,再放入模型中即可
foreach year in 2019 {
          foreach period in all wd wk {
         local commonvars "nonlocal100 SubwayNum BusStopSum Bar InternetBar PoliceStation GeneralHospital Clothes_Necessities Shoppingmall_Mansion ConvenientStore IntegreatedMarket WholesaleMarket Banks Supermarkets"
         local incomerate "`period'ratetotalambr12100 `period'ratetotalambr4100 `period'ratetotalambr5100 `period'ratetotalambr678100"
         local jh_diver_period_income " jh_diverallr12   jh_diverallr4 jh_diverallr5 jh_diverallr678"
         
      asdoc nbreg `period'theft`year'all dz_diver`period' dz_`period'totalambk  jh_diver`period'ambk  `incomerate' `commonvars' `jh_diver_period_income' , irr nolog setstars(*@.001, **@.01, ***@.05)
      *quiet reg  `period'theft`year'all ln`period'totalambk `incomerate' `commonvars'
      *estat vif
      corr `period'totalambk `incomerate' jh_diver`period'ambk
      estimates store M`period'`year'total
}
}

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群