楼主: niuniuyiwan
4835 11

[Stata] [Stata]演示教程命令集及Pyramid命令修改 [推广有奖]

  • 7关注
  • 91粉丝

VIP

已卖:1980份资源

学科带头人

91%

还不是VIP/贵宾

-

威望
0
论坛币
14446 个
通用积分
1962.3850
学术水平
1119 点
热心指数
1167 点
信用等级
1061 点
经验
8523 点
帖子
1629
精华
1
在线时间
2492 小时
注册时间
2010-10-10
最后登录
2025-12-19

楼主
niuniuyiwan 在职认证  发表于 2015-8-15 11:07:07 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币

命令

    演示教程内容(自学专用)

附件

aboutreg

回归分析

aboutreg.rar (8.6 KB) 本附件包括:
  • aboutreg.tut

bstrap /bstut

自助法

bstrap.rar (6.2 KB) 本附件包括:
  • bstrap.tut

pyramid

人口金字塔

pyramid.rar (6.98 KB)

randwalk /tt7

随机游走

randwalk.rar (3.42 KB) 本附件包括:
  • randwalk.hlp
  • randwalk.tut

sqc1/pca

计算工序能力指数Process Capability Indices(PCIs)

sqc1.zip (4.47 KB) 本附件包括:
  • cylinder.dat
  • pca.tut
  • pciest.ado
  • pciest.hlp

  1. findit aboutreg
  2. findit bstut
  3. findit pyramid
  4. findit sqc1
  5. findit randwalk
复制代码

安装使用:

1.command窗口输入cd或pwd
2.将附件解压到当前工作路径
2.在command窗口输入 tutorial 命令名
3.然后按Enter键不断执行

5.gif


注:

pyramid.tut在运行时出现codebook错误:
解决方法1.运行aboutreg.tut后再运行,

解决方法2.使用如下代码
(即保存为do文档代替演示,见附件)
解决方法3.对原命令进行修改,遇错后继续执行(见9楼):

  1. qui use fyn,clear
  2. gen sex = 1 in 3
  3. replace sex = 2 in 4
  4. label define sexlbl 1 male 2 female
  5. label value sex sexlbl
  6. drop if sex == .
  7. gen id = _n


  8. reshape long c, i(id) j(age)
  9. replace age = age-2                                                         

  10. drop if age > 99 | age < 0

  11. gen count = real(c)
  12. gen males = -real(c) if sex == 1
  13. gen females = real(c) if sex == 2

  14. replace females = real(c[_n+100]) if sex == 1
  15. drop in 101/200
  16. gen lbl =  age
  17. replace lbl = . if mod(age,10) > 0

  18. hbar males females, l(lbl)
  19. gen str2 slbl = string(lbl)
  20. replace slbl = " " if lbl == .

  21. hbar males females, l(slbl) lap /*
  22.   */ xla(-4250,-4000,-3000,-2000,-1000,0,1000,2000,3000,4000,4250) /*
  23.   */ ttick t1(Demographic composition, 1998) t2(Funen County, Denmark)/*
  24.   */ barfrac(0.85) xline(-1000,-2000,-3000,0,1000,2000,3000) saving(pyramid,replace)

  25. gsort -age

  26. more
  27. hbar males females, l(slbl) lap /*
  28.   */ xla(-4250,-4000,-3000,-2000,-1000,0,1000,2000,3000,4000,4250) /*
  29.   */ ttick t1(Demographic composition, 1998) t2(Funen County, Denmark)/*
  30.   */ barfrac(0.85) xline(-1000,-2000,-3000,0,1000,2000,3000) saving(pyramid,replace)

  31. more

  32. gen dif = males - (-females)
  33. label var dif "Male             Female          "

  34. hbar dif, l(slbl) lap /*
  35.   */ xla(-500,-250,0,250,500) t2(Diffence N males - N of females) /*
  36.   */ ttick t1(Female preponderance with age) /*
  37.   */ barfrac(0.85) xline(-250,0,250,500)
复制代码

5[0].gif




命令

作者

abooutreg    Stanislav Kolenikov
pyramid Jens M.Lauritsen: (v1.02)
randwalk    Albert Verbeek/Jeroen Weesie
bstrap   Stanislav Kolenikov
pca/sqc1    Sutaip L. C. Saw and Teck Wong Soon

二维码

扫码加我 拉你入群

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

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

关键词:Pyramid Stata tata Rami Amid 命令集

已有 2 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
xddlovejiao1314 + 100 + 100 + 5 + 5 + 5 精彩帖子
fantuanxiaot + 100 + 5 + 5 + 5 精彩帖子

总评分: 经验 + 200  论坛币 + 100  学术水平 + 10  热心指数 + 10  信用等级 + 10   查看全部评分

本帖被以下文库推荐

沙发
rrjj101022 发表于 2015-8-15 11:08:16
谢谢分享~~~
已有 2 人评分经验 论坛币 收起 理由
xddlovejiao1314 + 10 + 3 鼓励积极发帖讨论
niuniuyiwan + 5 感谢支持

总评分: 经验 + 10  论坛币 + 8   查看全部评分

藤椅
niuniuyiwan 在职认证  发表于 2015-8-18 15:43:31
2 . tutorial bstrap
  3
  4
  5            The bootstrap methods
  6                  Stanislav Kolenikov
  7                        skolenik@recep.glasnet.ru
  8 ------------------------------------------------
  9
10
11
12
13 This tutorial can be discontinued at any time by pressing Break (Ctrl-Break at
14 the keyboard or Break icon at the toolbar. Press Enter or Space when you see
15 --more-- message.
16
17
18
19
20 This tutorial overviews the main uses of the bootstrap procedures in
21 econometric practice. The Stata commands to be discussed are:
22
23               bs bstrap bstat bsample
24
25 You can get a more detailed information on each of them by invoking
26 help bs from Stata prompt after the tutorial session.
已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
xddlovejiao1314 + 100 + 50 + 3 + 3 + 3 精彩帖子

总评分: 经验 + 100  论坛币 + 50  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

板凳
niuniuyiwan 在职认证  发表于 2015-8-18 18:07:49
  1
  2 . tutorial aboutreg
  3
  4
  5
  6
  7            Regression and so on
  8                  Stanislav Kolenikov
  9                        skolenik@unc.edu
10 ------------------------------------------------
11
12
13
14
15 -------------------------------------------------------------------------------
16 In this tutorial we shall discuss some regression diagnostic techniques
17 and some regression remedies such as heteroskedasticity correction and
18 transformation of the dependent variable towards normality.
19
20 If you are continuing or repeating this tutorial, input the number of the
21 part you stopped last time, or just press Enter to continue:
22
23 1. From the very beginning
24 2. First regression -- naive and primitive OLS
25 3. Regression diagnostics commands
26 4. Tests for heteroskedasticity
27 5. Tests for nonlinearity
28 6. Tests for multicollinearity
29 7. Normality of residuals
30 8. Heteroskedasticiy correction
31 9. Transformation towards normality for the dependent variable
32
33 Now, please press the number of the section or Enter to continue:

已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
xddlovejiao1314 + 100 + 50 + 3 + 3 + 3 精彩帖子

总评分: 经验 + 100  论坛币 + 50  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

报纸
niuniuyiwan 在职认证  发表于 2015-8-18 18:10:04
  1 . tutorial randwalk
  2
  3
  4 ---------------------------------------------------------------------------
  5 Tutorial on random walks                     (Albert Verbeek/Jeroen Weesie)
  6
  7 This tutorial displays some discrete time random walks in 1 and 2
  8 dimensions, illustrating the use of graph and the use of random numbers. If
  9 you run the demo more than once, you will get different graphs each time.
10
11 First a one-dimensional, normal random walk
12 ---------------------------------------------------------------------------
13
14 . set obs 500                                        /* 500 observations */
15 number of observations (_N) was 0, now 500
16 . gen int t = _n                                             /* t = time */
17 . lab var t time = _n
18 . gen sumz = sum(invnorm(uniform()))          /* to be explained shortly */
19
20 ---------------------------------------------------------------------------
21 Explanation:
22
23 uniform() generates a random number from the uniform distribution on (0,1).
24 If it is transformed by the inverse of the cumulative distribution of a
25 random variable X, the result will have the same distribution as X. Here,
26 invnorm() is the inverse of the cumulative standard normal distribution.
27 So invnorm(uniform()) is a standard-normally distributed random number.
28 By taking the sum(), we get a random walk: a sum of independently and
29 identically distributed random numbers.
30 ---------------------------------------------------------------------------




已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
xddlovejiao1314 + 100 + 50 + 3 + 3 + 3 精彩帖子

总评分: 经验 + 100  论坛币 + 50  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

地板
niuniuyiwan 在职认证  发表于 2015-8-18 18:26:04
  1 . tutorial pca
  2
  3
  4
  5
  6
  7                  PROCESS CAPABILITY ANALYSIS USING STATA
  8                  ---------------------------------------
  9
10
11 In this tutorial, we show how to use Stata to perform a process capability
12 analysis of a subset of some data in DeVor, Chang & Sutherland (1992). It
13 consists of (coded) measurements of the inside diameter of machined cylinder
14 bores obtained in 31 samples, each of size 5. The (coded) lower and upper
15 specification limits are 195 and 203, respectively.
16
17 We begin the analysis by using Stata's xchart and rchart commands to determine
18 whether  the process is in control. If so, we then estimate the following
19 summary measures:
20                    - process mean and standard deviation
21                    - process capability indices
22                    - fraction nonconforming
23                    - percent yield
24
25 We also plot a histogram of the measurements and perform a Shapiro-Wilk test
26 for normality.
27
28 . infile x1-x5 using cylinder.dat
29 (31 observations read)

已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
xddlovejiao1314 + 100 + 50 + 3 + 3 + 3 精彩帖子

总评分: 经验 + 100  论坛币 + 50  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

7
niuniuyiwan 在职认证  发表于 2015-8-18 18:27:24
12.PNG 11.PNG

8
niuniuyiwan 在职认证  发表于 2015-8-27 16:54:11
  1. qui use fyn,clear
  2. gen sex = 1 in 3
  3. replace sex = 2 in 4
  4. label define sexlbl 1 male 2 female
  5. label value sex sexlbl
  6. drop if sex == .
  7. gen id = _n


  8. reshape long c, i(id) j(age)
  9. replace age = age-2

  10. drop if age > 99 | age < 0

  11. gen count = real(c)
  12. gen males = -real(c) if sex == 1
  13. gen females = real(c) if sex == 2

  14. replace females = real(c[_n+100]) if sex == 1
  15. drop in 101/200
  16. gen lbl =  age
  17. replace lbl = . if mod(age,10) > 0

  18. hbar males females, l(lbl)
  19. gen str2 slbl = string(lbl)
  20. replace slbl = " " if lbl == .

  21. hbar males females, l(slbl) lap /*
  22.   */ xla(-4250,-4000,-3000,-2000,-1000,0,1000,2000,3000,4000,4250) /*
  23.   */ ttick t1(Demographic composition, 1998) t2(Funen County, Denmark)/*
  24.   */ barfrac(0.85) xline(-1000,-2000,-3000,0,1000,2000,3000) saving(pyramid,replace)

  25. gsort -age

  26. more
  27. hbar males females, l(slbl) lap /*
  28.   */ xla(-4250,-4000,-3000,-2000,-1000,0,1000,2000,3000,4000,4250) /*
  29.   */ ttick t1(Demographic composition, 1998) t2(Funen County, Denmark)/*
  30.   */ barfrac(0.85) xline(-1000,-2000,-3000,0,1000,2000,3000) saving(pyramid,replace)

  31. more

  32. gen dif = males - (-females)
  33. label var dif "Male             Female          "

  34. hbar dif, l(slbl) lap /*
  35.   */ xla(-500,-250,0,250,500) t2(Diffence N males - N of females) /*
  36.   */ ttick t1(Female preponderance with age) /*
  37.   */ barfrac(0.85) xline(-250,0,250,500)
复制代码




已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
xddlovejiao1314 + 100 + 50 + 3 + 3 + 3 精彩帖子

总评分: 经验 + 100  论坛币 + 50  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

9
niuniuyiwan 在职认证  发表于 2015-9-2 12:35:09
对pyramid.tut的修改如下:(或见附件,解压至当前工作路径pwd/cd),在command窗口输入如下代码:
pyramid修改.rar (4.57 KB) 本附件包括:
  • pyramid.tut

  1. tutorial pyramid
复制代码
不断按住ENTER键即可

pyramid修改.PNG


已有 1 人评分经验 论坛币 学术水平 热心指数 信用等级 收起 理由
xddlovejiao1314 + 100 + 50 + 3 + 3 + 3 精彩帖子

总评分: 经验 + 100  论坛币 + 50  学术水平 + 3  热心指数 + 3  信用等级 + 3   查看全部评分

10
Kit-Baum 发表于 2015-11-26 10:35:28 来自手机
But .tut file wasn't recommended after version 8.
已有 1 人评分经验 论坛币 收起 理由
xddlovejiao1314 + 10 + 3 鼓励积极发帖讨论

总评分: 经验 + 10  论坛币 + 3   查看全部评分

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注jltj
拉您入交流群
GMT+8, 2026-1-1 12:28