作者typhoon20025 (typhoon20025)
看板Statistics
标题[程式] Stata的三个问题
时间Mon May 18 00:55:43 2015
------------------------------------------------------------------------
[软体程式类别]:
Stata
[程式问题]:
资料处理、回归、叙述统计
[软体熟悉度]:
低(1~3个月)
[问题叙述]:
问题一:
需要将资料分产业(ind,8个)及年份(year,12年)跑回归式,并保留回归式的残差项作
为变数,利用产生新变数yearind=year*100+ind,写回圈方式if yearind=k,就run
regression
程式如程式范例的问题一,
出现了unrecognized command: estpostr(199)的问题,
请问语法应该要怎麽做修正呢?
问题二:
(1)叙述性统计
(2)相关矩阵
以上两个程式如范例问题二,同样出现unrecognized command: estpostr(199)的问题
,请问语法应该要怎麽做修正呢?
问题三:
(1)t检定及(2)异质修正(heteroscedasticity corrected)程式如范例问题三
tse变数出现ambiguous abbreviationr(111)讯号,tse24 tse 25 tse26 tse27 tse28
tse29 tse30为虚拟变数不知道语法应该要如何做修正呢?
[程式范例]:
问题一:
est clear
estpost tab ind
esttab using regression.rtf, cells("b(label(freq)) pct(fmt(2))
cumpct(fmt(2))") varlabels(, blist(Total)) nonumber noobs replace
esttab using regression.csv, cells("b(label(freq)) pct(fmt(2))
cumpct(fmt(2))") varlabels(, blist(Total)) nonumber noobs replace
est clear
estpost tab year
esttab using regression, cells("b(label(freq)) pct(fmt(2)) cumpct(fmt(2))")
varlabels(, blist(Total)) nonumber noobs replace
esttab using regression, cells("b(label(freq)) pct(fmt(2)) cumpct(fmt(2))")
varlabels(, blist(Total)) nonumber noobs replace
gen dc_a= .
foreach k of local values {
reg ta_lag1a vlag1a drev_lag1_drec_lag1a ppe_lag1a if yearind== `k'
predict residuals, resid, if yearind== `k'
replace dc_a=residuals if resid!=.
drop residuals
问题二:
(1)叙述性统计
est clear
local vars "troi_a treps trroe eso ccq"
estpost sum `vars', detail
esttab using descriptive_statistics.rtf, cells("mean(fmt(3)) sd(fmt(2))
min(fmt(1)) max(fmt(0)) p25(fmt(2)) p50(fmt(2)) p75(fmt(2)) skewness(fmt(2))
kurtosis(fmt(2))") replace
esttab using descriptive_statistics.csv, cells("mean(fmt(3)) sd(fmt(2))
min(fmt(1)) max(fmt(0)) p25(fmt(2)) p50(fmt(2)) p75(fmt(2)) skewness(fmt(2))
kurtosis(fmt(2))") replace
(2)相关矩阵
est clear
pwcorr `vars'
qui estpost correlate `vars', matrix
esttab using correlation_matrix.rtf, unstack not noobs compress star(* 0.10
** 0.05 *** 0.01) b(3) replace
esttab using correlation_matrix.csv, unstack not noobs compress star(* 0.10
** 0.05 *** 0.01) b(3) replace
问题三:
(1)t检定:
reg troi_a eso_a s_a tse24 tse 25 tse26 tse27 tse28 tse29 tse30
estat hettest
tsset ind year
xtserial troi_a eso_a s_a tse24 tse 25 tse26 tse27 tse28 tse29 tse30
est clear
eststo: reg troi_a eso_a s_a tse24 tse 25 tse26 tse27 tse28 tse29 tse30
esttab , replace starlevels(* .1 ** 0.05 *** 0.01)
*输出在excel ".csv" / 输出在word ".rtf"
esttab * using test_H1-1.rtf ,replace
esttab * using test_H1-1.csv ,replace
(2)异质修正:
newey troi_a eso_a s_a tse24 tse 25 tse26 tse27 tse28 tse29 tse30
不好意思是第一次发文 排版有点乱请见谅 再麻烦高手帮忙解答 谢谢~~
-----------------------------------------------------------------------------
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 123.195.202.61
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Statistics/M.1431881746.A.E29.html
※ 编辑: typhoon20025 (123.195.202.61), 05/18/2015 00:58:11
1F:→ porfu: 第三个问题看来出在"tse 25"。Stata猜不出tse是哪个变数 05/18 09:40
2F:→ porfu: 前面两点的话,错误讯息说的是有一个estpostr的命令被输入 05/18 09:42
3F:→ porfu: 检查一下语法是不是都有拼对。 05/18 09:43
4F:推 evilove: 会不会没有装 estpost , 先 help estpost看一下 05/19 07:42
5F:→ evilove: tse 25 中间有空格 05/19 07:43
6F:→ typhoon20025: !!!问题解决了~~~非常谢谢楼上两位帮忙~~~谢谢你们~ 05/21 01:20