{smcl} {com}{sf}{ul off}{txt}{.-} log: {res}C:\Documents and Settings\gillian raab\My Documents\aprojects\peas\web\exemp5\data\ex5_res.smcl {txt}log type: {res}smcl {txt}opened on: {res}10 Dec 2004, 00:07:46 {txt} {com}. {txt}end of do-file {com}. run "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. . /*----------------------------------------------------------- > first define the design - only need weighting > -------------------------------------------------------------*/ . svyset [pweight=weight] {txt}pweight is weight {com}. {txt}end of do-file {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. /*----------------------------------------------------------- > now get proportions of various categories > compared with unweighted tables > -------------------------------------------------------------*/ . svyprop q85a {txt}{hline 78} pweight: weight Number of obs = {res} 358 {txt}Strata: Number of strata = {res} 1 {txt}PSU: Number of PSUs = {res} 358 {txt}Population size ={res} 430.92195 {txt}{hline 78} Survey proportions estimation {c TLC}{hline 28}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c TRC} {c |} {res} q85a Obs Est. Prop. Std. Err. {txt}{c |} {c LT}{hline 28}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c RT} {c |} {res} never used 210 0.583114 0.027406 {txt}{c |} {c |} {res} tried once or twice 90 0.249705 0.024043 {txt}{c |} {c |} {res} use daily 12 0.034062 0.010116 {txt}{c |} {c |} {res} use weekly 8 0.024087 0.008803 {txt}{c |} {c |} {res} used in last month 11 0.027770 0.008459 {txt}{c |} {c LT}{hline 28}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c RT} {c |} {res}used more than a month ago 27 0.081263 0.015942 {txt}{c |} {c BLC}{hline 28}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c BRC} {com}. tabulate q85a {txt}q85a {c |} Freq. Percent Cum. {hline 27}{c +}{hline 35} never used {c |}{res} 210 58.66 58.66 {txt} tried once or twice {c |}{res} 90 25.14 83.80 {txt} use daily {c |}{res} 12 3.35 87.15 {txt} use weekly {c |}{res} 8 2.23 89.39 {txt} used in last month {c |}{res} 11 3.07 92.46 {txt}used more than a month ago {c |}{res} 27 7.54 100.00 {txt}{hline 27}{c +}{hline 35} Total {c |}{res} 358 100.00 {txt} {com}. svyprop q85b {txt}{hline 78} pweight: weight Number of obs = {res} 338 {txt}Strata: Number of strata = {res} 1 {txt}PSU: Number of PSUs = {res} 338 {txt}Population size ={res} 407.87389 {txt}{hline 78} Survey proportions estimation {c TLC}{hline 6}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c TRC} {c |} {res}q85b Obs Est. Prop. Std. Err. {txt}{c |} {c LT}{hline 6}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c RT} {c |} {res} 1 281 0.820471 0.022514 {txt}{c |} {c |} {res} 2 32 0.097191 0.016914 {txt}{c |} {c |} {res} 3 1 0.002725 0.002726 {txt}{c |} {c |} {res} 4 1 0.004927 0.004918 {txt}{c |} {c |} {res} 5 5 0.016345 0.007902 {txt}{c |} {c LT}{hline 6}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c RT} {c |} {res} 6 18 0.058341 0.014174 {txt}{c |} {c BLC}{hline 6}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c BRC} {com}. tabulate q85b {txt}q85b {c |} Freq. Percent Cum. {hline 12}{c +}{hline 35} 1 {c |}{res} 281 83.14 83.14 {txt} 2 {c |}{res} 32 9.47 92.60 {txt} 3 {c |}{res} 1 0.30 92.90 {txt} 4 {c |}{res} 1 0.30 93.20 {txt} 5 {c |}{res} 5 1.48 94.67 {txt} 6 {c |}{res} 18 5.33 100.00 {txt}{hline 12}{c +}{hline 35} Total {c |}{res} 338 100.00 {txt} {com}. svyprop living {txt}{hline 78} pweight: weight Number of obs = {res} 361 {txt}Strata: Number of strata = {res} 1 {txt}PSU: Number of PSUs = {res} 361 {txt}Population size ={res} 435.17478 {txt}{hline 78} Survey proportions estimation {c TLC}{hline 15}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c TRC} {c |} {res} living Obs Est. Prop. Std. Err. {txt}{c |} {c LT}{hline 15}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c RT} {c |} {res} single 29 0.086536 0.016202 {txt}{c |} {c |} {res} sing parent 16 0.050037 0.012584 {txt}{c |} {c |} {res} couple 52 0.151834 0.020111 {txt}{c |} {c |} {res}couple w kids 62 0.179171 0.021241 {txt}{c |} {c |} {res} other 202 0.532421 0.027604 {txt}{c |} {c BLC}{hline 15}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c BRC} {com}. tabulate living {txt}living {c |} Freq. Percent Cum. {hline 14}{c +}{hline 35} single {c |}{res} 29 8.03 8.03 {txt} sing parent {c |}{res} 16 4.43 12.47 {txt} couple {c |}{res} 52 14.40 26.87 {txt}couple w kids {c |}{res} 62 17.17 44.04 {txt} other {c |}{res} 202 55.96 100.00 {txt}{hline 14}{c +}{hline 35} Total {c |}{res} 361 100.00 {txt} {com}. svyprop genhelf {txt}{hline 78} pweight: weight Number of obs = {res} 361 {txt}Strata: Number of strata = {res} 1 {txt}PSU: Number of PSUs = {res} 361 {txt}Population size ={res} 435.17478 {txt}{hline 78} Survey proportions estimation {c TLC}{hline 11}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c TRC} {c |} {res} genhelf Obs Est. Prop. Std. Err. {txt}{c |} {c LT}{hline 11}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c RT} {c |} {res}excellent 72 0.186660 0.020762 {txt}{c |} {c |} {res}very good 139 0.377625 0.026673 {txt}{c |} {c |} {res} good 120 0.343566 0.026397 {txt}{c |} {c |} {res} fair 24 0.070042 0.014328 {txt}{c |} {c |} {res} poor 6 0.022107 0.009443 {txt}{c |} {c BLC}{hline 11}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c BRC} {com}. tabulate genhelf {txt}genhelf {c |} Freq. Percent Cum. {hline 12}{c +}{hline 35} excellent {c |}{res} 72 19.94 19.94 {txt} very good {c |}{res} 139 38.50 58.45 {txt} good {c |}{res} 120 33.24 91.69 {txt} fair {c |}{res} 24 6.65 98.34 {txt} poor {c |}{res} 6 1.66 100.00 {txt}{hline 12}{c +}{hline 35} Total {c |}{res} 361 100.00 {txt} {com}. svyprop empl {txt}{hline 78} pweight: weight Number of obs = {res} 361 {txt}Strata: Number of strata = {res} 1 {txt}PSU: Number of PSUs = {res} 361 {txt}Population size ={res} 435.17478 {txt}{hline 78} Survey proportions estimation {c TLC}{hline 62}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c TRC} {c |} {res} empl Obs Est. Prop. Std. Err. {txt}{c |} {c LT}{hline 62}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c RT} {c |} {res} in paid work or self employed - full time 154 0.423934 0.027258 {txt}{c |} {c |} {res} in paid work or self employed - part time 44 0.119879 0.017706 {txt}{c |} {c |} {res} unemployed 22 0.073019 0.015595 {txt}{c |} {c |} {res}intending to look for work but prevented by temp sickness or 11 0.039017 0.012018 {txt}{c |} {c |} {res} looking after the home or family full time 22 0.066568 0.014096 {txt}{c |} {c LT}{hline 62}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c RT} {c |} {res} in full time education 108 0.277583 0.024020 {txt}{c |} {c BLC}{hline 62}{c -}{hline 5}{c -}{hline 12}{c -}{hline 11}{c BRC} {com}. tabulate empl {txt}empl {c |} Freq. Percent Cum. {hline 40}{c +}{hline 35} in paid work or self employed - full ti {c |}{res} 154 42.66 42.66 {txt}in paid work or self employed - part ti {c |}{res} 44 12.19 54.85 {txt} unemployed {c |}{res} 22 6.09 60.94 {txt}intending to look for work but prevente {c |}{res} 11 3.05 63.99 {txt}looking after the home or family full t {c |}{res} 22 6.09 70.08 {txt} in full time education {c |}{res} 108 29.92 100.00 {txt}{hline 40}{c +}{hline 35} Total {c |}{res} 361 100.00 {txt} {com}. {txt}end of do-file {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. /*---------------------------------------------------------------- > some code to recode drug use into scores so that they make > ordered categories > ------------------------------------------------------------------*/ . recode q85a (1=0) (2=0) (3=1) (4=1) (5=1) (6=0.5) ,gen (canscore) {txt}(358 differences between q85a and canscore) {com}. recode q85b (3=6) (1=0) (2=0) (3=1) (4=1) (5=1) (6=0.5) ,gen (ampscore) {txt}(338 differences between q85b and ampscore) {com}. /*------------------------------------------------------------- > now some mean scores to check design effects > ----------------------------------------------------------------*/ . svymean genhelf sinc sacc,de {err}option de not allowed {txt}{search r(198):r(198);} end of do-file {search r(198):r(198);} {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. svymean genhelf sinc sacc {txt}Survey mean estimation pweight:{col 11}weight{col 51}Number of obs{col 68}= {res} 361 {txt}Strata:{col 11}{col 51}Number of strata{col 68}= {res} 1 {txt}PSU:{col 11}{col 51}Number of PSUs{col 68}= {res} 361 {txt}{col 51}Population size{col 68}={res} 435.17478 {txt}{hline 9}{c TT}{hline 68} Mean {c |} Estimate Std. Err. [95% Conf. Interval] Deff {hline 9}{c +}{hline 68} {col 2}genhelf {c |}{res} 2.363313 .0527406 2.259594 2.467031 1.141333 {txt}{col 5}sinc {c |}{res} 18.71168 .6945963 17.3457 20.07766 1.312113 {txt}{col 5}sacc {c |}{res} -.0675717 .0328835 -.1322396 -.0029038 1.038462 {txt}{hline 9}{c BT}{hline 68} {com}. {txt}end of do-file {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. /*------------------------------------------------------------ > now some regressions to predict general health score > although this is categorical it is quite legitimate to > use it in a regression to look for simple associations > ----------------------------------------------------------*/ . svyregress genhelf sinc canscore ampscore {txt}Survey linear regression pweight: weight{col 51}Number of obs{col 68}= {res} 338 {txt}Strata: {col 51}Number of strata{col 68}= {res} 1 {txt}PSU: {col 51}Number of PSUs{col 68}= {res} 338 {txt}{col 51}Population size{col 68}={res} 407.87389 {txt}{res}{txt}{col 51}F({res} 3{txt},{res} 335{txt}){col 68}= {res} 11.82 {txt}{res}{txt}{col 51}Prob > F{col 68}= {res} 0.0000 {txt}{res}{txt}{col 51}R-squared = {res} 0.0688 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{c +}{hline 64} sinc {c |}{res} .0134715 .0050677 2.66 0.008 .0035033 .0234398 {txt}canscore {c |}{res} .5099733 .1471115 3.47 0.001 .2206008 .7993458 {txt}ampscore {c |}{res} .2301185 .0971406 2.37 0.018 .0390401 .4211969 {txt}_cons {c |}{res} 2.015085 .0902006 22.34 0.000 1.837658 2.192512 {txt}{hline 13}{c BT}{hline 64} {com}. regress genhelf sinc canscore ampscore {txt}Source {c |} SS df MS Number of obs ={res} 338 {txt}{hline 13}{char +}{hline 30} F( 3, 334) ={res} 7.77 {txt} Model {char |} {res} 18.0620294 3 6.02067648 {txt}Prob > F = {res} 0.0000 {txt}Residual {char |} {res} 258.757497 334 .774723046 {txt}R-squared = {res} 0.0652 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.0569 {txt} Total {char |} {res} 276.819527 337 .821422928 {txt}Root MSE = {res} .88018 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{char +}{hline 64} sinc {c |} {res} .0130195 .0045219 2.88 0.004 .0041245 .0219145 {txt} canscore {c |} {res} .5442357 .1625674 3.35 0.001 .2244507 .8640206 {txt} ampscore {c |} {res} .1936597 .1319918 1.47 0.143 -.0659802 .4532997 {txt} _cons {c |} {res} 2.019351 .0874236 23.10 0.000 1.84738 2.191321 {txt}{hline 13}{c BT}{hline 64} {com}. . {txt}end of do-file {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. /*--------------------------------------------------- > next bit of code gets some Stata commands that > enable you to generate nice output to paste into reports > > the findit command gives access to some regression formatiing > commands available from a submission to the Stata journal > NEED TO EDIT HOW TO DO THIS ON A CLEAN VERSION OF Stata > > http://www.ats.ucla.edu/stat/Stata/faq/outreg.htm > > Results are sent to an external file output.doc > ------------------------------------------------------*/ . findit outreg {txt} {com}. net from http://www.Stata.com {s6hlp} .- http://www.Stata.com/ ^StataCorp^ .- Welcome to StataCorp. Below we provide links to sites providing additions to Stata, including the Stata Journal, STB, and Statalist. These are NOT THE OFFICIAL UPDATES; you fetch and install the official updates by typing -^update^-. {smcl} PLACES you could -{hilite:net link}- to: {s6hlp} @net:link sj!sj@ The Stata Journal {smcl} DIRECTORIES you could -{hilite:net cd}- to: {s6hlp} @net:cd stb!stb@ materials published in the Stata Technical Bulletin @net:cd users!users@ materials by various people including StataCorp employees @net:cd meetings!meetings@ Stata user group meetings @net:cd quest7!quest7@ StataQuest additions for Stata 7 (Windows, Mac, and Unix) @net:cd quest!quest@ StataQuest additions for Stata 6 (Windows and Mac only) @net:cd links!links@ other locations providing additions to Stata {smcl} {.-} {com}. {txt}end of do-file {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. svyregress genhelf canscore {txt}Survey linear regression pweight: weight{col 51}Number of obs{col 68}= {res} 358 {txt}Strata: {col 51}Number of strata{col 68}= {res} 1 {txt}PSU: {col 51}Number of PSUs{col 68}= {res} 358 {txt}{col 51}Population size{col 68}={res} 430.92195 {txt}{res}{txt}{col 51}F({res} 1{txt},{res} 357{txt}){col 68}= {res} 9.21 {txt}{res}{txt}{col 51}Prob > F{col 68}= {res} 0.0026 {txt}{res}{txt}{col 51}R-squared = {res} 0.0225 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{c +}{hline 64} canscore {c |}{res} .4546734 .1498254 3.03 0.003 .1600221 .7493247 {txt}_cons {c |}{res} 2.283758 .0566644 40.30 0.000 2.17232 2.395196 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output.doc, nolabel replace {txt} {com}. svyregress genhelf ampscore {txt}Survey linear regression pweight: weight{col 51}Number of obs{col 68}= {res} 338 {txt}Strata: {col 51}Number of strata{col 68}= {res} 1 {txt}PSU: {col 51}Number of PSUs{col 68}= {res} 338 {txt}{col 51}Population size{col 68}={res} 407.87389 {txt}{res}{txt}{col 51}F({res} 1{txt},{res} 337{txt}){col 68}= {res} 3.45 {txt}{res}{txt}{col 51}Prob > F{col 68}= {res} 0.0640 {txt}{res}{txt}{col 51}R-squared = {res} 0.0141 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{c +}{hline 64} ampscore {c |}{res} .3016327 .1623158 1.86 0.064 -.0176471 .6209125 {txt}_cons {c |}{res} 2.323339 .0533271 43.57 0.000 2.218443 2.428235 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output.doc , nolabel append {txt} {com}. svyregress genhelf sinc {txt}Survey linear regression pweight: weight{col 51}Number of obs{col 68}= {res} 361 {txt}Strata: {col 51}Number of strata{col 68}= {res} 1 {txt}PSU: {col 51}Number of PSUs{col 68}= {res} 361 {txt}{col 51}Population size{col 68}={res} 435.17478 {txt}{res}{txt}{col 51}F({res} 1{txt},{res} 360{txt}){col 68}= {res} 8.13 {txt}{res}{txt}{col 51}Prob > F{col 68}= {res} 0.0046 {txt}{res}{txt}{col 51}R-squared = {res} 0.0323 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{c +}{hline 64} sinc {c |}{res} .0146277 .0051302 2.85 0.005 .0045388 .0247167 {txt}_cons {c |}{res} 2.089603 .0896386 23.31 0.000 1.913322 2.265884 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output.doc , nolabel append {txt} {com}. svyregress genhelf canscore sinc {txt}Survey linear regression pweight: weight{col 51}Number of obs{col 68}= {res} 358 {txt}Strata: {col 51}Number of strata{col 68}= {res} 1 {txt}PSU: {col 51}Number of PSUs{col 68}= {res} 358 {txt}{col 51}Population size{col 68}={res} 430.92195 {txt}{res}{txt}{col 51}F({res} 2{txt},{res} 356{txt}){col 68}= {res} 9.08 {txt}{res}{txt}{col 51}Prob > F{col 68}= {res} 0.0001 {txt}{res}{txt}{col 51}R-squared = {res} 0.0475 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{c +}{hline 64} canscore {c |}{res} .439577 .1504393 2.92 0.004 .1437184 .7354357 {txt}sinc {c |}{res} .01257 .004982 2.52 0.012 .0027723 .0223678 {txt}_cons {c |}{res} 2.051402 .0879524 23.32 0.000 1.878432 2.224372 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output.doc , nolabel append {txt} {com}. svyregress genhelf ampscore sinc {txt}Survey linear regression pweight: weight{col 51}Number of obs{col 68}= {res} 338 {txt}Strata: {col 51}Number of strata{col 68}= {res} 1 {txt}PSU: {col 51}Number of PSUs{col 68}= {res} 338 {txt}{col 51}Population size{col 68}={res} 407.87389 {txt}{res}{txt}{col 51}F({res} 2{txt},{res} 336{txt}){col 68}= {res} 6.23 {txt}{res}{txt}{col 51}Prob > F{col 68}= {res} 0.0022 {txt}{res}{txt}{col 51}R-squared = {res} 0.0426 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{c +}{hline 64} ampscore {c |}{res} .2850634 .1402797 2.03 0.043 .0091292 .5609975 {txt}sinc {c |}{res} .0134487 .0051076 2.63 0.009 .0034019 .0234955 {txt}_cons {c |}{res} 2.072104 .0915095 22.64 0.000 1.892103 2.252106 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output.doc , nolabel append {txt} {com}. svyregress genhelf canscore ampscore {txt}Survey linear regression pweight: weight{col 51}Number of obs{col 68}= {res} 338 {txt}Strata: {col 51}Number of strata{col 68}= {res} 1 {txt}PSU: {col 51}Number of PSUs{col 68}= {res} 338 {txt}{col 51}Population size{col 68}={res} 407.87389 {txt}{res}{txt}{col 51}F({res} 2{txt},{res} 336{txt}){col 68}= {res} 9.14 {txt}{res}{txt}{col 51}Prob > F{col 68}= {res} 0.0001 {txt}{res}{txt}{col 51}R-squared = {res} 0.0402 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{c +}{hline 64} canscore {c |}{res} .5090293 .1505447 3.38 0.001 .2129036 .805155 {txt}ampscore {c |}{res} .2468177 .1188762 2.08 0.039 .0129848 .4806505 {txt}_cons {c |}{res} 2.266851 .0580489 39.05 0.000 2.152667 2.381035 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output.doc , nolabel append {txt} {com}. svyregress genhelf canscore ampscore sinc {txt}Survey linear regression pweight: weight{col 51}Number of obs{col 68}= {res} 338 {txt}Strata: {col 51}Number of strata{col 68}= {res} 1 {txt}PSU: {col 51}Number of PSUs{col 68}= {res} 338 {txt}{col 51}Population size{col 68}={res} 407.87389 {txt}{res}{txt}{col 51}F({res} 3{txt},{res} 335{txt}){col 68}= {res} 11.82 {txt}{res}{txt}{col 51}Prob > F{col 68}= {res} 0.0000 {txt}{res}{txt}{col 51}R-squared = {res} 0.0688 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{c +}{hline 64} canscore {c |}{res} .5099733 .1471115 3.47 0.001 .2206008 .7993458 {txt}ampscore {c |}{res} .2301185 .0971406 2.37 0.018 .0390401 .4211969 {txt}sinc {c |}{res} .0134715 .0050677 2.66 0.008 .0035033 .0234398 {txt}_cons {c |}{res} 2.015085 .0902006 22.34 0.000 1.837658 2.192512 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output.doc , nolabel append {txt} {com}. {txt}end of do-file {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. /*----------------------------------------------------- > now the same thing for an unweighted regression > ------------------------------------------------------*/ . . regress genhelf canscore {txt}Source {c |} SS df MS Number of obs ={res} 358 {txt}{hline 13}{char +}{hline 30} F( 1, 356) ={res} 10.25 {txt} Model {char |} {res} 8.14533065 1 8.14533065 {txt}Prob > F = {res} 0.0015 {txt}Residual {char |} {res} 282.874222 356 .794590512 {txt}R-squared = {res} 0.0280 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.0253 {txt} Total {char |} {res} 291.019553 357 .815180821 {txt}Root MSE = {res} .8914 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{char +}{hline 64} canscore {c |} {res} .5028069 .157043 3.20 0.001 .1939583 .8116554 {txt} _cons {c |} {res} 2.236383 .0509959 43.85 0.000 2.136092 2.336674 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output2.doc, nolabel replace {txt} {com}. regress genhelf ampscore {txt}Source {c |} SS df MS Number of obs ={res} 338 {txt}{hline 13}{char +}{hline 30} F( 1, 336) ={res} 3.73 {txt} Model {char |} {res} 3.04173794 1 3.04173794 {txt}Prob > F = {res} 0.0542 {txt}Residual {char |} {res} 273.777789 336 .814814847 {txt}R-squared = {res} 0.0110 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.0080 {txt} Total {char |} {res} 276.819527 337 .821422928 {txt}Root MSE = {res} .90267 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{char +}{hline 64} ampscore {c |} {res} .2594266 .1342712 1.93 0.054 -.0046916 .5235447 {txt} _cons {c |} {res} 2.282698 .0498025 45.84 0.000 2.184734 2.380662 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output2.doc , nolabel append {txt} {com}. regress genhelf sinc {txt}Source {c |} SS df MS Number of obs ={res} 361 {txt}{hline 13}{char +}{hline 30} F( 1, 359) ={res} 9.90 {txt} Model {char |} {res} 8.20930765 1 8.20930765 {txt}Prob > F = {res} 0.0018 {txt}Residual {char |} {res} 297.790692 359 .829500536 {txt}R-squared = {res} 0.0268 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.0241 {txt} Total {char |} {res} 306 360 .85 {txt}Root MSE = {res} .91077 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{char +}{hline 64} sinc {c |} {res} .0142075 .0045162 3.15 0.002 .005326 .023089 {txt} _cons {c |} {res} 2.095164 .0849479 24.66 0.000 1.928106 2.262222 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output2.doc , nolabel append {txt} {com}. regress genhelf canscore sinc {txt}Source {c |} SS df MS Number of obs ={res} 358 {txt}{hline 13}{char +}{hline 30} F( 2, 355) ={res} 9.13 {txt} Model {char |} {res} 14.2324683 2 7.11623415 {txt}Prob > F = {res} 0.0001 {txt}Residual {char |} {res} 276.787085 355 .779681929 {txt}R-squared = {res} 0.0489 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.0435 {txt} Total {char |} {res} 291.019553 357 .815180821 {txt}Root MSE = {res} .883 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{char +}{hline 64} canscore {c |} {res} .4936069 .1555976 3.17 0.002 .187598 .7996158 {txt} sinc {c |} {res} .0123342 .0044143 2.79 0.005 .0036527 .0210157 {txt} _cons {c |} {res} 2.046646 .084634 24.18 0.000 1.880199 2.213093 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output2.doc , nolabel append {txt} {com}. regress genhelf ampscore sinc {txt}Source {c |} SS df MS Number of obs ={res} 338 {txt}{hline 13}{char +}{hline 30} F( 2, 335) ={res} 5.87 {txt} Model {char |} {res} 9.37935175 2 4.68967587 {txt}Prob > F = {res} 0.0031 {txt}Residual {char |} {res} 267.440175 335 .79832888 {txt}R-squared = {res} 0.0339 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.0281 {txt} Total {char |} {res} 276.819527 337 .821422928 {txt}Root MSE = {res} .89349 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{char +}{hline 64} ampscore {c |} {res} .248102 .1329667 1.87 0.063 -.0134529 .5096569 {txt} sinc {c |} {res} .0129331 .0045902 2.82 0.005 .0039039 .0219623 {txt} _cons {c |} {res} 2.081722 .0867068 24.01 0.000 1.911164 2.252281 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output2.doc , nolabel append {txt} {com}. regress genhelf canscore ampscore {txt}Source {c |} SS df MS Number of obs ={res} 338 {txt}{hline 13}{char +}{hline 30} F( 2, 335) ={res} 7.35 {txt} Model {char |} {res} 11.6396446 2 5.81982232 {txt}Prob > F = {res} 0.0008 {txt}Residual {char |} {res} 265.179882 335 .791581737 {txt}R-squared = {res} 0.0420 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.0363 {txt} Total {char |} {res} 276.819527 337 .821422928 {txt}Root MSE = {res} .88971 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{char +}{hline 64} canscore {c |} {res} .5415636 .164324 3.30 0.001 .2183267 .8648004 {txt} ampscore {c |} {res} .2053269 .1333573 1.54 0.125 -.0569963 .4676501 {txt} _cons {c |} {res} 2.221969 .052432 42.38 0.000 2.118832 2.325107 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output2.doc , nolabel append {txt} {com}. regress genhelf canscore ampscore sinc {txt}Source {c |} SS df MS Number of obs ={res} 338 {txt}{hline 13}{char +}{hline 30} F( 3, 334) ={res} 7.77 {txt} Model {char |} {res} 18.0620294 3 6.02067648 {txt}Prob > F = {res} 0.0000 {txt}Residual {char |} {res} 258.757497 334 .774723046 {txt}R-squared = {res} 0.0652 {txt}{hline 13}{char +}{hline 30} Adj R-squared = {res} 0.0569 {txt} Total {char |} {res} 276.819527 337 .821422928 {txt}Root MSE = {res} .88018 {txt}{hline 13}{c TT}{hline 64} genhelf {c |} Coef. Std. Err. t P>|t| [95% Conf. Interval] {hline 13}{char +}{hline 64} canscore {c |} {res} .5442357 .1625674 3.35 0.001 .2244507 .8640206 {txt} ampscore {c |} {res} .1936597 .1319918 1.47 0.143 -.0659802 .4532997 {txt} sinc {c |} {res} .0130195 .0045219 2.88 0.004 .0041245 .0219145 {txt} _cons {c |} {res} 2.019351 .0874236 23.10 0.000 1.84738 2.191321 {txt}{hline 13}{c BT}{hline 64} {com}. outreg using output2.doc , nolabel append {txt} {com}. /*---------------------------------------------- > now look at the proportions in health groups > by the original categories of cannabis use > and a survey-corrected chi square > ----------------------------------------------*/ . . svytab genhelf q85a,column percent {txt}pweight: weight{col 49}Number of obs{col 68}= {res} 358 {txt}Strata: {col 49}Number of strata{col 68}= {res} 1 {txt}PSU: {col 49}Number of PSUs{col 68}= {res} 358 {txt}{col 49}Population size{col 68}={res} 430.92195 {txt}{hline 10}{c TT}{hline 69} {c |} q85a genhelf {c |} never us tried on use dail use week used in used mor Total {hline 10}{c +}{hline 69} excellen {c |} {res}22.12 19.36 6.093 9.15 0 8.462 18.85 {txt}very goo {c |} {res}40.07 35.29 41.22 29.52 16.95 41.52 38.14 {txt}good {c |} {res}29.17 37.21 52.68 41.97 54.49 47.69 34.5 {txt}fair {c |} {res}6.549 8.149 0 19.36 20.33 2.325 7.073 {txt}poor {c |} {res}2.088 0 0 0 8.231 0 1.446 {txt}{c |} Total {c |} {res}100 100 100 100 100 100 100 {txt}{hline 10}{c BT}{hline 69} Key: {col 1}{res}column percentages {txt} Pearson: {col 5}Uncorrected{col 19}chi2({res}20{txt}){col 35}= {res} 26.0092 {txt}{col 5}Design-based{col 19}F({res}18.84{txt}, {res}6725.01{txt}){col 35}= {res} 1.2200{col 51}{txt}P = {res}0.2307 {txt} {com}. {txt}end of do-file {com}. svyset [pweight=weight], fpc(29000) {err}29000 invalid name in option fpc() {txt}{search r(198):r(198);} {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. /*------------------------------------------ > now test out the effect of the finite population correction > The number of women of this age group in the > population is 29457. This will be set as the population > size for all units since there is no startification here > --------------------------------------------------*/ . generate popsize=29457 {txt} {com}. {txt}end of do-file {com}. svyset [pweight=weight], fpc(popsize) {txt}pweight is weight fpc is popsize {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. svyset [pweight=weight],fpc(popsize) {txt}pweight is weight fpc is popsize {com}. /*--------------------------------------------- > now rerun one svy mean from above > it makes little difference > -----------------------------------------------------------*/ . svymean genhelf sinc sacc {txt}Survey mean estimation pweight:{col 11}weight{col 51}Number of obs{col 68}= {res} 361 {txt}Strata:{col 11}{col 51}Number of strata{col 68}= {res} 1 {txt}PSU:{col 11}{col 51}Number of PSUs{col 68}= {res} 361 {txt}FPC:{col 11}popsize{col 51}Population size{col 68}={res} 435.17478 {txt}{hline 9}{c TT}{hline 68} Mean {c |} Estimate Std. Err. [95% Conf. Interval] Deff {hline 9}{c +}{hline 68} {col 2}genhelf {c |}{res} 2.363313 .0524164 2.260232 2.466393 6.614006 {txt}{col 5}sinc {c |}{res} 18.71168 .690327 17.3541 20.06926 7.603672 {txt}{col 5}sacc {c |}{res} -.0675717 .0326814 -.1318421 -.0033013 6.017872 {txt}{hline 9}{c BT}{hline 68} Finite population correction (FPC) assumes simple random sampling without replacement of PSUs within each stratum with no subsampling within PSUs. Weights must represent population totals for deff to be correct when using an FPC. Note: deft is invariant to the scale of weights. {com}. {txt}end of do-file {com}. do "C:\DOCUME~1\GILLIA~1\LOCALS~1\Temp\STD03000000.tmp" {txt} {com}. svyset [pweight=gweight],fpc(popsize) {txt}pweight is gweight fpc is popsize {com}. /*--------------------------------------------- > now rerun one svy mean from above > it makes little difference > Though the first run was wrong because it needed > to have weights that add to population totals > -----------------------------------------------------------*/ . svymean genhelf sinc sacc {txt}Survey mean estimation pweight:{col 11}gweight{col 51}Number of obs{col 68}= {res} 361 {txt}Strata:{col 11}{col 51}Number of strata{col 68}= {res} 1 {txt}PSU:{col 11}{col 51}Number of PSUs{col 68}= {res} 361 {txt}FPC:{col 11}popsize{col 51}Population size{col 68}={res} 29456.894 {txt}{hline 9}{c TT}{hline 68} Mean {c |} Estimate Std. Err. [95% Conf. Interval] Deff {hline 9}{c +}{hline 68} {col 2}genhelf {c |}{res} 2.363313 .0524164 2.260232 2.466393 1.141333 {txt}{col 5}sinc {c |}{res} 18.71168 .690327 17.3541 20.06926 1.312113 {txt}{col 5}sacc {c |}{res} -.0675717 .0326814 -.1318421 -.0033013 1.038462 {txt}{hline 9}{c BT}{hline 68} Finite population correction (FPC) assumes simple random sampling without replacement of PSUs within each stratum with no subsampling within PSUs. Weights must represent population totals for deff to be correct when using an FPC. Note: deft is invariant to the scale of weights. {com}. {txt}end of do-file {com}. exit, clear