Thursday, February 23, 2012

Tips - Stata: How to get rate

Tips – Stata: How to get rates by multiple variables for complex sampling designed data (-svy-)

If one wants to get the rates of variable 'dmb20' (0, 1) among adults with 'DM' by 'survey' and 'age3grp', he/she can use different ways to get them, three basic approaches are listed below:  

1. Use –subpop-
.svy, subpop(if DM==1 & age3grp==1): tab survey dmb20, obs row percent ci format(%5.1f)
.svy, subpop(if DM==1 & age3grp==2): tab survey dmb20, obs row percent ci format(%5.1f)
.svy, subpop(if DM==1 & age3grp==3): tab survey dmb20, obs row percent ci format(%5.1f)

2. Use –proportion-
.svy, subpop(if DM==1): proportion dmb20, over(survey age3grp)

3. Use –ratio-
.svy, subpop(if DM==1): ratio (dmb20/DM), over(survey age3grp)

NOTES: The better part of -svy: tab- is using a logit transform to produce confidence intervals of estimates, which makes the confidence interval always between 0 and 1.

However, the one advantage of using 2 & 3 is you can use post estimation commands, such as -testnl- or -nlcom-, flexibly.

we also can use -svy: total- to get the total numbers like use -count- of -svy: tab-, and followed by the post estimation commands.

Thursday, February 09, 2012

Tips - Stata: Building complicated expressions the easy way

Tips - Stata: Building complicated expressions the easy way


Step-by-step:
  • run a command of analysis
  • .db display
  • click 'Create...'
  • use 'expression builder' to create the complicated formula. It will help to use correct expressions
  • click 'ok' and 'submit'.
  • then, copy and paste the formula to a 'do' or 'ado' file for further use.

You can find a more detailed article here

Tuesday, February 07, 2012

Objective measurement of physical activity: best practices and future directions

Objective Measurement of Physical Activity:  Best Practices and Future Directions

source: Medicine & Science in Sports & Exercise


This journal supplement summarizes and builds upon a workshop which convened researchers from diverse sectors and organizations to critically review the state-of-the-science.


The supplement discusses current technologies for objective physical activity monitoring, provides recommendations for the use of these technologies, and explores future directions in the development of new tools and approaches. It presents best practices for using physical activity monitors in population-based research, explores modeling of physical activity outcomes from wearable monitors, and discusses statistical considerations in the analysis of accelerometry-based activity monitor data. It also examines monitor equivalency issues and discusses current use and best practices for accelerometry with particular populations—children, older adults, and adults with functional limitations. 


Open-access, full-text of all articles is available at here.

Tips - Stata: function and extended function to -generate- and -egen-

Tips - Stata: function vs. extended function & -generate- vs. -egen-


Stata provids two kinds of functions: regular functions and extended functions (or called egen function). These functions need to be used with other Stata commands, usually -generate- and -egen-. -generate- is for regular function, or -egen- for egen function and only -egen- may be used to run egen function. some function may look similar but different:


  • sum(var) and total(var) (a -egen- function)with -bysort-
    • Sum() is a regular function. When you use .gen sum1=sum(var), it will generate a new variable named 'sum1' with cumulative summation of 'var' from top to bottom in order of group.
    • However, total() as a egen function used in .egen sum2=total(var), it will generate a new variable named 'sum2' with summation of 'var' of all observation from top to bottom in that group. All the cases in that group have the same values of 'sum2'.
  • recode(var,cutpt1,cutpt2,cutpt3,...),  irecode(var,x1,x2,...,xn) and group(varlist) (a -egen- function)



Thursday, February 02, 2012

Phys Ed: Exercise as Housecleaning for the Body - NYTimes.com

Exercise as Housecleaning for the Body
source: New York Times
... More striking, when Dr. Levine stuffed both groups of animals with high-fat kibble for several weeks until they developed a rodent version of diabetes, the normal mice subsequently reversed the condition by running, even as they continued on the fatty diet. The autophagy-resistant animals did not. After weeks of running, they remained diabetic. Their cells could not absorb blood sugar normally. They also had higher levels of cholesterol in their blood than the other mice. Exercise had not made them healthier.
In other words, Dr. Levine and her colleagues concluded, an increase in autophagy, prompted by exercise, seems to be a critical step in achieving the health benefits of exercise. ...

Original article published in Nature