Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: Recreating SAS "sums of squares" in Stata using anova and regress


From   David Fisher <djfisher81@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Recreating SAS "sums of squares" in Stata using anova and regress
Date   Wed, 19 Feb 2014 10:02:41 +0000

Dear all,

As part of a larger piece of research, I am interested in recreating
the series of related one-stage meta-analysis models described by Senn
(2000)*.  These are described in terms of SAS-style ANOVA "sums of
squares", which I would like to recreate in terms of a regression
model.

The models are as follows:
Model 2: Fixed trial strata, fixed treatment effect, no interaction
(i.e. the standard one-stage fixed-effects meta-analysis model)
Model 4.1: Trial + treatment interaction model using Type II SS
Model 4.2: Trial + treatment interaction model using Type III SS.

Given outcome "y", treatment "trt" and trial strata "trial", where the
effect of interest is that of "trt" (binary), Model 2 can be fitted
as:
. anova y i.trial i.trt
or
. regress y i.trial i.trt

Model 4.2 can be fitted as:
. anova y i.trial##i.trt
or
. regress y i.trial##i.trt
. contrast r.trt, asbalanced

No problems -- the anova and regress F and p values for "trt" match exactly.

Now, Model 4.1 can be fitted as:
. anova y i.trial##i.trt, seq

...and I thought that this could be recreated with regress using
"contrast, asobserved", that is:
. qui regress y i.trial##i.trt
. contrast r.trt, asobserved

But the F and p values for "trt", whilst close, are not the same.

Have I misunderstood what "contrast" is doing here (I am a
statistician, but don't use ANOVA in my day-to-day work, so this may
well be the case)?  If so, is there a way to recreate this ANOVA
result using "regress"?  If not, why not?

Many thanks,

David.


* Senn S. The many modes of meta. Drug Information Journal 2000; 34: 535-49




David Fisher
Statistician
MRC Clinical Trials Unit at UCL
Aviation House
125 Kingsway
London  WC2B 6NH

Direct line: +44 (0)20 7670-4646
Main switchboard: +44 (0)20 7670-4700
e-mail:  d.fisher@ucl.ac.uk
Website: http://www.ctu.mrc.ac.uk/
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index