tceic.com
>> >>

stata


? 1



Stata Computer Resource Center 19851998 1.11.2 1.31.4 1.5 2.02.13.0 3.1 4.05. 06.0 Stata Stata WORD Stata 640k 3.1Stata2400 99 4.0 WINDOWS Stata 4800 99 WINDOWS 95 5.0 32M 2 trade () Stata 20 Cox Weibull logistic Poisson  Stata (2 )


10?



Stata Stata display display 3+22 7 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. abs(x) exp(x) log(x) log10(x) sqrt(x) sin(x) cos(x) atan(x) lngamma(x) mod(x,y) /* /* /* /* /* /* /* /* /*x ln[(x-1)!] /*x ydisplay mod(25,3)1

1. 2. 3. 4. normprob(df,x) invnorm(p) Binomial(n,k,p) invbinomial(n,k,p) ݧ ˗

5. 6.


tprob(df,t) invt(df,P)



? 11

7. 8.

fprob(df1,df2,f) ◫ invfprob(df1,df2,p) ◫◫ 9. chiprob(df,x) 10. nchi(df,L,x) 11. invnchi(df,L,p) ϗϗ 12. gammap(a,x) 13. invgammap(a,p) 14. ibeta(a,b,x) 15. uniform( ) 16. invnorm(uniform( )) 17. ?+invnorm(uniform()) ? 1. length(s) 2. substr(s,n1,n2) 3. string(n) ĥ 4. real(s) 5. upper(s) 6. lower(s) 7. index(s1,s2) ˨֦æ 8. trim(s) 9. ltrim(s) 10. rtrim(s) 1. sign(x) x>01, x<0-1, x=00 2. int(x) x , int(x+0.5) x int(x+sign(x)/2)x 3. sum(x) x (missing value) 0 4. max(x1,x2,...,Xn)


12?

5. min(x1,x2,...,Xn) 6. D group(x) x , 1, 2,..., x 7. float(x) xStata , , , x 1.1, x1.1 , x, 1.1 , 0.00000002384, xfloat(1.1), , 8. cond(x,a,b) x, x0() a, x0() b 9. Drecode(x,x1 ,x2,...,xn) : x1 x<=x1 x2 x1 <x<=x2 x3 x2 <x<=x3 recode(x,x1 ,x2, ,xn ) = xn-1 xn-2 <x<=xn-1 xn x>xn-1 x 10Dautocode(x,ng,xmin,xmax) xmin,xmaxng xD


Stata Dos 8 Dos Stata ( )2.1
dct raw do dta log gph xp ASC ASC Stata Stata Stata Stata xp

Stata (AZ a-z) (0 9)( _ )




? 13

<=8 Stata Stata _all _n _N _skip _b _coef _c ons _pi _pred _rc _weight double float long int in if using with Stata25480 1_coef[]_b[] Cox logit probit [ ] _coef[drug[2]] coef[drug[2]*disease[1]] logistic [ ]() 2_cons 1_b[_cons]] 3_N 4_n ˨ 5_pi 6_rc capture Stata_result(#) Stata _result(#) _result(#)# n1,2,3,45 2.2
correlate 1 2. 31 count 1 inspect 1 2 3 4 _result(n) 4. 5. 1

5. 6. 7. 8.




14? describe or describe using 1 4. 2 5. 3 6. cox,logit,or probite 1. 3. 2 4.2 anova,regress,or stepwise 1 6.F 7.R2 2 3 8.R2 4 9. 5, Factor 1 71 2 82 3 2 4 2 52 1913 62 Oneway 1 5. 2 6.F 3 7.Bartlett2 4 8.Bartlett2 Summarize 1 9.25detail 2 10.50detail 3 11.75detail 4 12.90detail 5 13.95detail 6 14.detail 75detail 15.detail 810detail, Tabulate 1 8.Fisher 2 9.Cramer V 3 10.gamma 4Pearson 2 11.gamma ASSE 5Pearson 2 12.tau-b 6l.r. 2 13.tau-b ASSE 7l.r. 2 , Test 2 5. 3 6.F 4 anova ,






? 15


stata+* / ^

x / y (x?y) x/y^ (x-y)/(x?y) xy

this + isthisis Stata >>=<<= = = =Stata 10 ASCII֧Stataǧ֧ ˧՗ٵ &( ) |( ) Stata 10 ] ><<=>= 2.3Stata disp֧ ֧
2+ this substr(string(20+2),1,1)+upper(substr(rf ,1+1,1) Zebra > cat (2==2)+1 (3>2)+1 3>2+1 3>2&5>4 (3>2)&(5>4)

16?

generate replacedisplay generatereplace



2?

( ) ӧ logistic logistic Probit logistic Poisson Kaplan-Meier Mantel-Haenszel Wilcoxon-Gehan Cox Tobit Weibull kappa  ˧ŧ ŧ Stata Cholesky Kronecker Stata 400400 (4040) ] Stata Stataado ()Stata զ ҧ nPoisson
prog define rp set obs `2 set seed `3 gen rp=. local lamda0=exp(`1 ) local j=1 while `j <`2 +1 { /* /* /* /* /* /* /* rp Poisson lamda0=exp() j=1 j<n j jPoisson

? 3 local i=1 local r0=1 while `i >0 { local r1=uniform() local r0=`r1 *`r0 if `r0 < `lamda0 { local n0= `i -1 local i=-1 } local i= `i +1 } quiet replace rp=`n0 if _n==`j local j= `j +1 } end /* /* /* /* /* /* /* /* i=1 r0=1 i r1= r0=r1*t0 r0<lamda0 n0= i-1 i=-1

/* i /* j rp n0 /* j


ڧ ۧ








4?


ʦ D:\>Stata ڷ B Ħ . exit ħ . eclear (eexit )Stata Stata . exit Wstata

Stata Stata File , exit , Stata StataData has changed without being saved. Do you really want to exit?( ) WINDOWSDOSStata


StataWINDOWSStataStata ħ


? 5

1.1 x 1 2 3 4 5 y 4 5.5 6.2 7.7 8.5 Stata





Statad:\mydata\ ex1.dta \ \׳ d:mydataex1.dtaStatadta StataStatause \ file d:\ mydata\ex1.dta already exists replace \\ \ Stata d:mydataex1.dta Stata , I



6?


Stata(B ) log result1 Stata.log , ڧ(help)result1.log log off log on log close result1.log log using result1result1. logresult1.logreplace \ result1.log EDITPE2 WPS WORD DOStype print ͧsaving 1.1x y ex1.gph ĥ

y x d:\mydata\ ex1.gph (gphStata)Stata graph


? 7

using d:\mydata\ex1 File Print Graph gphdot DOSStata DOSgphdot


Stata Stata Stata 1.2 \ p 1.3
\ \ ĥ \ \

Stata Stataex1.log ex1.dta ex1.gph Stata


8?


Stata Statahelp(F1)





? 9

͉Ή 1 by varlistvarlist group 123 4by group:Stata group=1, group=2, group=3 group=44 sort, . sort group 2 weight [fw=][aw= ] 3 if exp,


in range
~ ~44 ~(last) C

ا for x1,x2 , ,x22 22 y1,y2 , ,y10,z1 , ,z5 15 yi zi x1,x2 , ,x22  15 for for y1-y10 z1-z5 : regress @ x1-x22 for regress @ IStata for I x1-x22 for y* : summ @,detail y


Stata

? 17


Stata Stata


Stata 4 Stata ASCIIdbaseFoxbaseSAS SPSS input 3.1
x0 x1

Stata inputx0 x1Statax0 x1 Enter endStata


18?

Stata

listStatasave \ d:\ mydata ex3-1.dta Stata dta StataStatause WindowsStataeditorStata edit Stata Editor , Stata Stata 1var1,2 var2 Preserve rename



Stata

? 19

Stata ASCII infile using ASCII WPS,PE2,EDIT,WORDWINDOWS֧3.1 3.2 ex3-1.txt d:\mydata\(ASCII)


Stata: \ save infile ] transfer DOSdbasefoxbase Stata foxbase Stata transfer dbasefoxbase3.1 ex3-1.dbfd:\mydata\ , ex3-1.dbfStatatransfer DOS transfer transfer

20?

Stata

\ \ \


\\ \ \ \ \ \ \ \ \ \ \ \ \\ \

transfer 1-2-3dbaseIIdbaseIIIFoxbaseSAS SPSSSYSTAT Stata Foxbase

Stata \ \\ \ \ \ \ \ \ \ \ \ \ \ \\ \\\׳

? 21

Stata
\ 8\

8 \\\\ \ \\ \ \ \ \\\ ؉\ \ \ \ ׳

22?

Stata

8 8 C [Enter]d:\mydata\ex31.dtaStatatransfer Stata use ] ʼn\ \


describeex3-1.dta , describe F3
\ \ s

d:\mydata\ ex3-1.dta 4720 99(Stata1.1) 2 x0,x1 8x0x18 gg e f 3.4

Stata

? 23

label var
\

ʍIdescribe
s \

x0 x1 ex3-1.dta group1yes ( )0 no () 1 0 label define group 10



\

lab list

24?

Stata



label data
\ s \ ؉\\


\\ \


Stata
sort


\

Stata

? 25

drop ߧ ~ keep keepdrop drop ߧ append using 3.2 ex3-2.dtaex3-1.dta
\

4 3 x0,x1 ex3-1.dta g ex3-2.dta ex3-1.dtaex3-1.dta


26?

Stata



12( )3( ) ex3-1.dtaֵ ] merge using 3.3 ex3-3.dta bh 1 5 ex3-4.dta bh 1,3,4,6ex3-3.dta ex3-3.dta 2 5bh=6 ex3-3.dta ex3-4,dta ֧
\ ⧳ \\I \ \\ ⧳

Stata \ⳅ \

? 27

Stata_merge1 23 ħԨ_merge1 Ԧħ _merge 2 _merge=3( ) I \ I \
\u \ \ \I \ĥĥ \㧵

^ \ \

28?

Stata

des 402 \\


des "float %9.0g"StatagStata Stata efx g_fmtg_fmte_fmt f_fmt \ g_fmte_fmtgformat e_fmtf_fmt :
\ \ ؉\\

list

Stata

? 29

ʿ ʿ ʿ Љ ʿ e %9.2e 32.5 3.25e+01 3.25 3.25e+00fǧ0.0000056 %9.2f 0.00 g e fǧ 1.1%9.2g 1.10%9.1g1.1 "%9.0g" 1.1format x %9s x 9

30

?







ڧ Stata () describe summary centile
summarize [] [, detail ] centile [] [, centile(# [# ...]) cci normal meansd level(#) ]


detail meansd cci normal level(#) /* /* /* /* /*

L 1982 110 7 (cm):


Stata

? 31


\ \

summ ަʧ x (Obs) (Mean)(Std.Dev.)(Min)(Max) detail( d)
\

9 (Percentiles) 1%5%10% 25%50%75% 90%95% 99% 110.3112.3113.1116.1119.9122.8 125.7128.0 130.8 4 4 (Varance) (Skewness) (Kurtosis)=0 =3 0 , 0 , 0 3 3 , 3 ^ centile
\

32

?



\\\ɭ \\

centile 3 2.5%50% 97.5% ˦ 95% 2.5% 110.6875 95% (108.2,112.389)*(108.2) ˨ norm
\ \\\ɭ

norm Stata cci(conservative confidence interval)
\ \\\ɭ \\

Stata

x + u s
u x =119.7273s=4.741325 2.5% 119.7273-1.964.741325=110.4343 centile meansd
\ \\\ɭ

(4.1)

Stata

? 33


tabulate tab1 tabulate tab2 [, generate() missing nofreq nolabel plot ] 1 1 2 2 3 [, missing nolabel plot ] [, cell column row missing nofreq] 3 [, tabulate_options ] 1 2


generate() nofreq nolabel plot missing cell column row /* /* /* /* /* /* ( 1) /* ( 1) /* ( 1)

(group)(sex)sex=1 sex=0 (x1,%)(x2,/mm3 ) d:\mydata\ex4-2.dta
\

34

?








12 117 g1,g2,g3


Stata group 3 (group 3 ) g Stata g1,g2,g3


Stata ᴌ

? 35




36

?





row


y cell




Stata

? 37


tab summ() tab 1 2 summ()

summ 4.2





38

?






Stata () ()(Poisson )
ci [, level(#) binomial poisson exposure() by( ) total ]

Stata n, x , s n,x n,x()
cii cii cii [, level(#) ] [, level(#) ] , poisson [level(#) ] /* /* /* Poisson


level(#) binomial/poisson exposure() by() total /* /* /* Poisson /* /* by()


\ \ɭ \ɭ \ɭ

Stata

? 39

(Std. Err.) 95 (95% conf. Interval) cii





10 Q(HBsAg) 2 HBsAg cii


0.2 0.1265 95%(0.0252, 0.5563) 100cm2 1 24 8 100cm2 95%
\\ɭ

1 1 100cm2 100cm2 95% (3.5,15.8)

40

?

Stata


Stata Stata Stata graph (histogram) (bar), (oneway) (pie) (twoway) (matrix) (star) ˧ŧ








Stata

? 41










42

?

Stata













Stata

? 43


(histogram) (bar) (pie) (twoway) (box) help graph
graph [ ] [, ]


bin(#) freq normal[(#,#)] density(#) shading(s) axis/ noaxis border/noborder xlable/ylable/tlable/rlable[(#,,#)] /* # 5 /* /* N(#,#) # /* normal 100 /* 14 3 /* / /* / /* lable xlable,ylable, tlable, rlable x y x y /* tick /* line /* x y /* Stata /* b (x ),l (y ) t r /* /* 18 8 /* replace I

xtick/ytick/ttick/rtick[(#,,#)] xline/yline/tline/rline[(#,,#)] xscale/yscale[(#,,#)] title([][][] ) b1/l1/t1/rl([][][]) b2/l2/t2/r2([][][]) gap(#) saving( [,replace])]


\




44

?

Stata




Ȼ





Stata 9 (bin(9)) (freq) (norm) x 119.7273 22.4802 (xlab,ylab)̧(gap) height (CM) Stata ( ) t1 t2b1b2l1l2 r1 r2է


Stata

? 45


graph 1 [ 2[...]], bar []


means stack accumulate totle shading(s) axis/ noaxis [no]alt border/noborder /* /* /* /* /* 14 3 /* / /* /*

xlable/ylable/tlable/rlable[(#,...,#)], ytick[(#,...,#)], yline[(#,...,#)], yscale[(#,,#)] , title(["][ ]["]), b1/l1/t1/rl(["][ ]["]), b2/l2/t2/r2(["][]["]), gap(#), saving([,replace])] ticklinescale y 5.2








46

?

Stata



\
\


s

ȧ
\\ \\ \ s \ \\ \\ \\ \


ԉ\\

sh(31) shading(31)3 1 1952 1972 ,3 1 grash [: 5.11 WORD ]


Stata

? 47







\\

Χ
graph 1 2 [...] ,pie []

48

?

Stata

shading(#,...#) by() accumulate totle title(["][]["]]) t|l|b|r1|2title(["][]["]) saving( [,replace]) 5.3 \


h \h
graph y [y 2[...]] x , []

connect(c...c) c(c...c)
/* c . () l L x m s J || II ||, /* s O S T o d

Symbol(s...s) s(s...s)



Stata p . i [varname] [_n]

? 49


axis/ noaxis border/nobordertwoway boxsort xlable/ylable/tlable/rlable[(#,...,#)]xtick/ytick/ttick/rtick[(#,...,#)] xline/yline/tline/rline[(#,...,#)]xscale/yscale[(#,,#)] title(["][]["])b1/l1/t1/rl(["][]["]) b2/l2/t2/r2(["][]["]) gap(#)saving( [,replace])]


\




s(o) gra graph 4
ĥ ĥ ĥ ĥ

50

?

Stata




symbol(s) (a)(b) (c) (d)4 s(d) s(p)s(.)s(T) connect(c) (a)(b) (c) (d)4 c(l) c(J)c(L) sort (a) (b) sort sort sort s() c() sort graph c(cc) s(s s) 5.5 ⁣()
(h) 0 11.81.4 10.61.5 2 18.52.3 16.32 4 25 3.4 18.92.1 6 27.32.9 22.61.9 8 30.43.2 22.81.8 10 31.73.4 22.62.3 12 32.53.5 22.92.2


\

Stata

? 51

 ˨ ˨


k
\ \ \ \ \ \

52

?

Stata

\


\ \










Stata

? 53

] ˨ ˦˧˨
gra , oneway gra , oneway box

§
gra y x , twoway box

5.6








54

?

Stata

Stata WINDOWS WORD ȧި Stata



ا Stata 100 150200 OK 4.0 ڧ Stata 5.0 ڧStata ֧ set text ^ Stata 100 150


Stata

? 55

set text 150 graph ħ DOS Stata gphdot WINDOWS Stata Print Graph , DOS gphdot ħ
gphdot [/r#] [/rx#] [/ry#] [/n]




WORD ͧ N



56

?




˧ ˧


t student's t (1)(2) (3) Stata t ttest
ttest = #val

Stata ttesti
ttesti #obs #mean #sd #val

#obs #mean #sd #val 10 (g/dl)
: : (x,g/dl) 1 11.3 2 15.0 3 15.0 4 13.5 5 12.8 6 10.0 7 11.0 8 12.0 9 13.0 10 12.3

14.02(g/dl) ? 10 12.59(g/dl) 4.02 10 14.02 ۦ 14.02 k H0 ()=14.02

Stata

? 57

n10 x 12.59 s1.63 t H0 t |t H0 t n t P P () n-()ͤ H0 P H0 H0 P H0 0.05 P ttest


d:\mydata\ex5-1.dta: \ t :
\ ɭ

(Obs) (Mean)(Std.Dev) (Min)(Max)(Test) H0 t (t-statistics)(d.f.) (Prob > |t|) t-2.77P 0.0218<0.050.05 H0 14.02(g/dl) #obs=10#mean=12.59,#sd=1.632629 #val=14.02 ttesti
\

58

?



ɭ

ttesti 4 4

6.2 t
ԧ () t 0 0 H0 0 Stata t ttest
ttest 1= 2

1 2ttest [if ][in ] 6.110 (g/dl)
: 1 11.3 14.0 2 15.0 13.8 3 15.0 14.0 4 13.5 13.5 5 12.8 13.5 6 10.0 12.0 7 11.0 14.7 8 12.0 11.4 9 13.0 13.8 10 12.3 12.0 ( x 0 ) : ( x 1 ) :

t 





d:\mydata\ex6-2.dta
\ \

Stata ɭ

? 59


ɭ

.68t=1.31 9P=0.2237=0.05 d d t


x1 x0 t Φ  t Stata t
ttest ttest 1= 2, unpaired [ unequal welch ] , by( ) [unequal welch]

ttesti #obs1 #mean1 #sd1 #obs2 #mean2 #sd2 [, unequal welch ]

1 2 Stata ()unpaired Stata t 1 1 2 2 by() 6 #obs #mean #sd l 1 2 2 [][in ] [if ] unequal welch Welch Satterthwaite welch unequal 14 11 17

60

?



(mg/dl)
2.90 5.18 5.41 8.79 5.48 3.14 4.60 6.46 4.03 3.72 5.10 6.64 4.97 5.60 4.24 4.57 4.36 7.71 2.72 4.99 2.37 4.01 2.09 7.10 5.92

(1)


d:\mydata\ex6-3.dtat
\ ɭ

1.81 23 P=0.0839>0.05=0.05 17 (mg/dl) ܦ unequal Stata (assuming equal variances) t'
\ \ ɭ

Stata (assuming unequal variances) welch (w )Stata Welch 21.19 w Stata Satterthwaite \

Stata \ ɭ

? 61

Satterthwaite 19.47 Welch 21.19 (2)

:

stata_.ppt

stata - Stata Stata ,StataSAS SPSS ...

Stata0706_.ppt

Stata0706___Stata ৵ 2015/07/06 2015/11/29 1 Stata 2015/11/29 2 ...

Stata.doc

1.2 Stata 2 Windows Stata

2. STATA.pdf

2. STATA___STATA

Stata.doc

Stata 1 1.reg y x1 x2 predict xxx pre

Stata _.pdf

Stata __IT/_Stata ^?\ gu Jj ^?{0 ? ?? Stata Group Study gu ?H...

stata _.ppt

stata - ?

stata.pdf

9 10 6. end 2) stata stata , edit stata window (: ...

stata.ppt

stata_/__ stata stata ? stata Stata...

stata_.ppt

stata - Stata Stata ,StataSAS SPSS ...

stata.doc

stata_/__stata, 1. STATA ,? (1)Twoway ...

Stata_.ppt

Stata - 2013-8-22 1

Implementing Propensity Score Matching Estimators with STATA.unkown

Implementing Propensity Score Matching Estimators with STATA Barbara Sianesi University College London and Institute for Fiscal Studies E-mail: barbara_s@ifs....

stata.doc

() stata () 2009-03-25

Latexstata.pdf

Latexstata___Latexstata A Creating LTEX documents from within Stata Ben Jann ETH Zrich u German Stata ...

Stata_.pdf

STATA STATA STATA STATA STATA STATA 1 STATA ...

Stata _.ppt

Stata 20113 Stata Stata

stata_.pdf

() j=1 j<n,jjPoisson Stata ? 3 local i=1 local r0=1 while `i { >0 local r1=...

2008_Stata_.ppt

2008_Stata__IT/_2008_Stata Scottish Social Survey Network: Master Class 1 Data Analysis with ...

STATA.doc

STATA - : (1) , .xls STATA : ) hebufen.xls ...

|
All rights reserved Powered by www.tceic.com
copyright ©right 2010-2021
zhit325@126.com