|
|
|
||||
|
|
|||||
The examples below use Stata 7 or 8. If you are using Stata version 9, please see this page.Page 130, Table 5.1
use "a:\table5.dta", clear rename col1 town rename col2 hours list
+---------------+
| town hours |
|---------------|
1. | A 35 |
2. | A 28 |
3. | A 26 |
4. | A 41 |
5. | A 43 |
|---------------|
6. | A 29 |
7. | A 32 |
8. | A 37 |
9. | A 36 |
10. | A 25 |
|---------------|
11. | A 29 |
12. | A 31 |
13. | A 39 |
14. | A 38 |
15. | A 40 |
|---------------|
16. | A 45 |
17. | A 28 |
18. | A 27 |
19. | A 35 |
20. | A 34 |
|---------------|
21. | B 27 |
22. | B 4 |
23. | B 49 |
24. | B 10 |
25. | B 15 |
|---------------|
26. | B 41 |
27. | B 25 |
28. | B 30 |
29. | RURAL 8 |
30. | RURAL 15 |
|---------------|
31. | RURAL 21 |
32. | RURAL 7 |
33. | RURAL 14 |
34. | RURAL 30 |
35. | RURAL 20 |
|---------------|
36. | RURAL 11 |
37. | RURAL 12 |
38. | RURAL 32 |
39. | RURAL 34 |
40. | RURAL 24 |
+---------------+
Page 131, Figure 5.1
graph hbox hours, by(town) ylabel(0(12)48) ytitle("Hours")
Page 131, the middle of the page
gen wt = 155/20 replace wt = 62/8 if town == "B" replace wt = 93/12 if town == "RURAL" svyset [pweight=wt], strata(town) svymean hours
Survey mean estimation
pweight: wt Number of obs = 40
Strata: town Number of strata = 3
PSU: <observations> Number of PSUs = 40
Population size = 310
------------------------------------------------------------------------------
Mean | Estimate Std. Err. [95% Conf. Interval] Deff
---------+--------------------------------------------------------------------
hours | 27.675 1.503762 24.62809 30.72191 .7065466
------------------------------------------------------------------------------
gen location = 1 replace location = 2 if town == "B" replace location = 3 if town == "RURAL" svymean hours, by(location) sort location by location: tabstat hours, s(n mean p50 sd)
_______________________________________________________________________________
-> location = 1
variable | N mean p50 sd
-------------+----------------------------------------
hours | 20 33.9 34.5 5.94625
------------------------------------------------------
_______________________________________________________________________________
-> location = 2
variable | N mean p50 sd
-------------+----------------------------------------
hours | 8 25.125 26 15.24502
------------------------------------------------------
_______________________________________________________________________________
-> location = 3
variable | N mean p50 sd
-------------+----------------------------------------
hours | 12 19 17.5 9.36143
------------------------------------------------------
Page 135, at the bottom
svytotal hours
Survey total estimation
pweight: wt Number of obs = 40
Strata: town Number of strata = 3
PSU: <observations> Number of PSUs = 40
Population size = 310
------------------------------------------------------------------------------
Total | Estimate Std. Err. [95% Conf. Interval] Deff
---------+--------------------------------------------------------------------
hours | 8579.25 466.1662 7634.708 9523.792 .7065466
------------------------------------------------------------------------------
UCLA Researchers are invited to our Statistical Consulting Services
We recommend others to our list of Other Resources for Statistical Computing Help
These pages are Copyrighted (c) by UCLA Academic Technology Services