全部版块 我的主页
论坛 计量经济学与统计论坛 五区 计量经济学与统计软件 Stata专版
6891 5
2017-11-07
我有一个问题,就是当你的数据样本有2万个,但是跑回归的时候所用的样本回归为1.5万个,请问怎样精确找出所用到的这1.5万个样本数呢?
二维码

扫码加我 拉你入群

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

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

全部回复
2017-11-8 07:49:19
1353679112 发表于 2017-11-7 21:20
我有一个问题,就是当你的数据样本有2万个,但是跑回归的时候所用的样本回归为1.5万个,请问怎样精确找出所 ...
还有5000个样本没参与回归应该是包含缺失值,你使用keep或drop命令删除缺失值,剩下的就是你参与回归的样本了。祝好运~
二维码

扫码加我 拉你入群

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

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

2017-11-8 08:12:52
回归完执行

gen id=e(sample)
id=1 就表示参与回归的



Stored results

    regress stores the following in e():

    Scalars        
      e(N)                number of observations
      e(mss)              model sum of squares
      e(df_m)             model degrees of freedom
      e(rss)              residual sum of squares
      e(df_r)             residual degrees of freedom
      e(r2)               R-squared
      e(r2_a)             adjusted R-squared
      e(F)                F statistic
      e(rmse)             root mean squared error
      e(ll)               log likelihood under additional assumption of i.i.d.  normal errors
      e(ll_0)             log likelihood, constant-only model
      e(N_clust)          number of clusters
      e(rank)             rank of e(V)

    Macros         
      e(cmd)              regress
      e(cmdline)          command as typed
      e(depvar)           name of dependent variable
      e(model)            ols or iv
      e(wtype)            weight type
      e(wexp)             weight expression
      e(title)            title in estimation output when vce() is not ols
      e(clustvar)         name of cluster variable
      e(vce)              vcetype specified in vce()
      e(vcetype)          title used to label Std. Err.
      e(properties)       b V
      e(estat_cmd)        program used to implement estat
      e(predict)          program used to implement predict
      e(marginsok)        predictions allowed by margins
      e(asbalanced)       factor variables fvset as asbalanced
      e(asobserved)       factor variables fvset as asobserved

    Matrices      
      e(b)                coefficient vector
      e(V)                variance-covariance matrix of the estimators
      e(V_modelbased)     model-based variance

    Functions      
      e(sample)           marks estimation sample

二维码

扫码加我 拉你入群

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

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

2017-11-8 14:42:22
xddlovejiao1314 发表于 2017-11-8 07:49
还有5000个样本没参与回归应该是包含缺失值,你使用keep或drop命令删除缺失值,剩下的就是你参与回归的样 ...
这是一种方法,但是如果加入很多if条件的话,逐个条件去keep或者drop还是比较繁琐易出错,如果有更简便的方法就更好了
二维码

扫码加我 拉你入群

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

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

2017-11-8 14:50:45
蓝色 发表于 2017-11-8 08:12
回归完执行

gen id=e(sample)
这种方法可以,我试了下我跑的样本数和id=1的样本数是一样的,多谢,我执行code: regress stores the following in e(N) 说'e' invalid observation number怎么解决?
二维码

扫码加我 拉你入群

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

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

2021-1-13 09:11:49
蓝色 发表于 2017-11-8 08:12
回归完执行

gen id=e(sample)
受教了!多谢!ps:蓝色老师太可爱了,整个这么大蓝色字体进行说明
二维码

扫码加我 拉你入群

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

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

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

说点什么

分享

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