STATA怎么用?希望有老師可以系統(tǒng)的輔導(dǎo)一下
stata基本知識(shí):
1、基本操作 :
(1)窗口鎖定:Edit-preferences-general preferences-windowing-lock splitter
(2)數(shù)據(jù)導(dǎo)入;
(3)打開文件:use E:\example.dta,clear
(4)日期數(shù)據(jù)導(dǎo)入:
gen newvar=date(varname, “ymd”) format newvar %td 年度數(shù)據(jù)
gen newvar=monthly(varname, “ym”) format newvar %tm 月度數(shù)據(jù)
gen newvar=quarterly(varname, “yq”) format newvar %tq 季度數(shù)據(jù)
(5)變量標(biāo)簽 :
Label variable tc ` “total output” ’
(6)審視數(shù)據(jù):
describe
list x1 x2
list x1 x2 in 1/5
list x1 x2 if q>=1000
drop if q>=1000
keep if q>=1000
(7)考察變量的統(tǒng)計(jì)特征:
summarize x1
su x1 if q>=10000
su q,detail
su
tabulate x1
correlate x1 x2 x3 x4 x5 x6
(8)畫圖 :
histogram x1, width(1000) frequency
kdensity x1
scatter x1 x2
twoway (scatter x1 x2) (lfit x1 x2)
twoway (scatter x1 x2) (qfit x1 x2)
(9)生成新變量:
gen lnx1=log(x1)
gen q2=q^2
gen lnx1lnx2=lnx1*lnx2
gen larg=(x1>=10000)
rename larg large
drop large
g large=(q>=6000)
replace large=(q>=6000) drop ln*
(10)計(jì)算功能:
display log(2)
(11)線性回歸分析:
regress y1 x1 x2 x3 x4
vce #顯示估計(jì)系數(shù)的協(xié)方差矩陣
reg y1 x1 x2 x3 x4,noc #不要常數(shù)項(xiàng)
reg y1 x1 x2 x3 x4 if q>=6000
reg y1 x1 x2 x3 x4 if large
reg y1 x1 x2 x3 x4 if large==0
reg y1 x1 x2 x3 x4 if ~large
predict yhat
predict e1,residual
display 1/_b[x1]
test x1=1 # F檢驗(yàn),變量x1的系數(shù)等于1
test (x1=1) (x2+x3+x4=1) # F聯(lián)合假設(shè)檢驗(yàn)
test x1 x2 #系數(shù)顯著性的聯(lián)合檢驗(yàn)
testnl _b[x1]= _b[x2]^2
(12)約束回歸 :
constraint def 1 x1+x2+x3=1
cnsreg y1 x1 x2 x3 x4,c(1)
cons def 2 x4=1
cnsreg y1 x1 x2 x3 x4,c(1-2)
(13)stata的日志 :
File-log-begin-輸入文件名
log off 暫時(shí)關(guān)閉
log on 恢復(fù)使用
log close 徹底退出
(14)stata命令庫(kù)更新 :
Update all help command
Stata 是一套提供其使用者數(shù)據(jù)分析、數(shù)據(jù)管理以及繪制專業(yè)圖表的完整及整合性統(tǒng)計(jì)軟件。它提供許許多多功能,包含線性混合模型、均衡重復(fù)反復(fù)及多項(xiàng)式普羅比模式
以上是一些小的基本技巧,同學(xué)如果需要系統(tǒng)的老師的詳細(xì)輔導(dǎo)可以聯(lián)系我們哦~