Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

re: st: syntax for nested two-factor ANOVA


From   "Erick Turner" <[email protected]>
To   [email protected]
Subject   re: st: syntax for nested two-factor ANOVA
Date   Mon, 10 Apr 2006 08:56:58 -0700

Thanks for that feedback. Let me clarify.
My data looks like this:

brand company keep testresult
1 1 1 .839
1 1 0 .605
2 1 1 .798
2 1 0 .567
3 2 1 .855
3 2 0 .650
etc etc etc etc

(I agree that modeling with "keep" as the DV makes sense, and I plan to also do that w/ logistic regression.)

The main thing I want to look at is indeed the relationship between "keep" and "testresult", controlling for the other two variables, with brand nested within company. So yes, I guess we want to treat brand and company as random effects (and "keep" as fixed).

Example II.D in the link says it's for both factors being random.

Does this additional info help enough to specify the proper command syntax?

Thanks again.

Erick


------------------------------

Date: Sun, 9 Apr 2006 17:03:49 -0700
From: "Erick Turner" <[email protected]>
Subject: st: syntax for nested two-factor ANOVA

I have been puzzling through the examples on nested ANOVAs given in
the manual, but I think my model is somewhat different from those. I
could use help setting up the proper command syntax.

My data structure is this:

My DV is "testresult" (continuous)
IVs are all categorical:  "brand" is nested within "company", but the
IV of main interest is "keep" (1 or 0, for sold or discarded).

So I want to see whether the "keep rate" is affected significantly
and primarily by testresult, after controlling for the brand and the
company making that brand.

I would expect there should be error terms for testresult*brand and/
or testresult*company.

Related question: would this employ a sequential sum of squares
rather than a partial sum of squares, entering in the "confounds"
first and then IV of key interest last?

Below is my confused attempt at a command and the result, which only
yields a single F value, that being for the whole model, and no F
values for the factors.

 anova testresult brand company keep brand*keep company*keep / brand|
company, sequential

                            Number of obs =      89     R-squared
=  0.3971
                            Root MSE      = .204223     Adj R-squared
=  0.2081

                   Source |    Seq. SS     df       MS
F     Prob > F
            --------------
+----------------------------------------------------
                    Model |  1.84058059    21  .087646695
2.10     0.0116
                          |
                    brand |   .69112847    11  .062829861
                  company |           0     0
                     keep |  .905309904     1  .905309904
               brand*keep |  .244142211     9  .027126912
             company*keep |           0     0
            brand|company |           0     0
            --------------
+----------------------------------------------------
                          |
                 Residual |  2.79437683    67  .041707117
            --------------
+----------------------------------------------------
                    Total |  4.63495741    88  .052669971

- ------------------------

Thanks in advance for help with the proper syntax for what I'm trying
to do.

Erick



*
*   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/

------------------------------

Date: Sun, 9 Apr 2006 21:26:27 -0500
From: David Airey <[email protected]>
Subject: re: st: syntax for nested two-factor ANOVA

I don't think you provide enough information to get the exact anova
model you want. Since you said nested two factor ANOVA, do you have
data like this?

brand		company		sold(keep)     	replicates

1               1               1		3
1               1               0		9

2               1               1		etc.
2		1		0

3               1               1
3		1		0

4               2               1
4		2		0

5               2               1
5		2		0

6		2		1
6		2		0

Forgetting if "keep" might be better modeled as a DV, then brand is
nested in company and brand|company is crossed with keep.

Are you interested in particular brands, or companies, or just trying
to control for random (nested) data? If in fact you want to treat
both brand and company as random effects you might look at:

II. A, B, C, and D at:

http://online.sfsu.edu/~efc/classes/biol458/repnestn/repnestn3.htm

with attention to D.

- -Dave

*

*
*   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/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index