Exactly what I needed. Thank you, Ken!!!
Best,
Ricardo.
--- [email protected] wrote:
> Ricardo Ovaldia <[email protected]> asks:
>
> > I was approached by an investigator with the
> following
> > problem. He had two groups of experimental rats,
> 10
> > diabetic and 10 non-diabetic. Each of these rats
> had
> > one liter of 10 pups (average). On each of the
> pups a
> > series of biochemicals were measured. He wants me
> to
> > compare the mean value of these biochemicals from
> the
> > pumps from diabetic moms to the pups from
> non-diabetic
> > pups. He then suggested that I do a simple t-test
> > comparing the means of the two pup groups. I
> pointed
> > out that the observations are not independent
> because
> > of several pups from the same liter and that the
> liter
> > effect needs to be taken into account.
> >
> > How can I set this up in Stata?
>
> Assuming I understand your setup, you have a nested
> ANOVA model.
> I ran the following commands to create some fake
> data that I think
> has a similar form as yours.
>
> clear
> set obs 2
> gen group = _n
> expand 10
> sort group
> qui gen mom = _n in 1/10
> qui replace mom = mom[_n-10] in 11/20
> set seed 32981
> gen z = 10 + round(uniform()*4-2,1)
> expand z
> drop z
> bysort group mom : gen pup = _n
> gen y = uniform()*8 + group
> compress
>
> I then looked at a table of pup counts and y value
> means for each
> group (meaning diabetic & nondiabetic moms) and each
> mom within
> group. The nested ANOVA results are then shown.
>
> . table mom group, c(mean y freq)
>
> ------------------------------
> | group
> mom | 1 2
> ----------+-------------------
> 1 | 4.290885 5.353604
> | 11 8
> |
> 2 | 5.389515 6.748766
> | 9 9
> |
> 3 | 4.533185 6.990387
> | 9 12
> |
> 4 | 4.732775 5.633358
> | 8 10
> |
> 5 | 6.142506 4.981017
> | 10 8
> |
> 6 | 5.124625 5.217069
> | 9 10
> |
> 7 | 5.285787 5.418501
> | 11 11
> |
> 8 | 5.234306 6.799588
> | 11 9
> |
> 9 | 5.171794 6.379981
> | 8 9
> |
> 10 | 6.112025 6.664215
> | 10 8
> ------------------------------
>
> . anova y group / mom|group /
>
> Number of obs = 190
> R-squared = 0.1047
> Root MSE = 2.40589 Adj
> R-squared = 0.0046
>
> Source | Partial SS df MS
> F Prob > F
>
>
-----------+----------------------------------------------------
> Model | 115.021745 19 6.05377604
> 1.05 0.4119
> |
> group | 31.203949 1 31.203949
> 6.80 0.0178
> mom|group | 82.6298147 18 4.59054526
>
>
-----------+----------------------------------------------------
> mom|group | 82.6298147 18 4.59054526
> 0.79 0.7065
> |
> Residual | 984.009577 170 5.78829163
>
>
-----------+----------------------------------------------------
> Total | 1099.03132 189 5.81498054
>
>
> I added a little group effect into my fake data
> (notice the
> p-value of .0178).
>
>
> Ken Higbee [email protected]
> StataCorp 1-800-STATAPC
>
> *
> * For searches and help try:
> *
> http://www.stata.com/support/faqs/res/findit.html
> * http://www.stata.com/support/statalist/faq
> * http://www.ats.ucla.edu/stat/stata/
=====
Ricardo
Statistician
Center for Applied Research
University Hospital
Oklahoma City,OK
__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/