Notice: On March 31, it was **announced** that Statalist is moving from an email list to a **forum**. The old list will shut down on April 23, and its replacement, **statalist.org** is already up and running.

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

From |
Richard Williams <richardwilliams.ndu@gmail.com> |

To |
statalist@hsphsun2.harvard.edu, "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |

Subject |
Re: st: difference between -test- and -contrast- in Statat 12 |

Date |
Thu, 25 Aug 2011 23:33:40 -0400 |

At 10:15 PM 8/25/2011, Ricardo Ovaldia wrote:

I am using the new -contrast- command in Stata 12 to test a contrastafter ANOVA and I get different p-values than when using -test-although the marginal means are the same.

I illustrate with the auto data by first making the rep78 variable a3 level variable and then running an ANOVA follow by -contrast-:. sysuse auto,clear . replace rep78=3 if rep78<3 . anova price rep78##foreign <output omitted> . contrast r.foreign@rep78 Contrasts of marginal linear predictions Margins : asbalanced ------------------------------------------------- | df F P>F --------------+---------------------------------- foreign@rep78 | (1 vs 0) 3 | 1 0.73 0.3965 (1 vs 0) 4 | 1 0.07 0.7881 (1 vs 0) 5 | 1 0.80 0.3743 Joint | 3 0.53 0.6606 | Residual | 63 ------------------------------------------------- --------------------------------------------------------------- | Contrast Std. Err. [95% Conf. Interval] --------------+------------------------------------------------ foreign@rep78 | (1 vs 0) 3 | -1529.739 1792.049 -5110.862 2051.385 (1 vs 0) 4 | 379.8889 1407.262 -2432.3 3192.078 (1 vs 0) 5 | 2088.167 2333.681 -2575.322 6751.655 ---------------------------------------------------------------From the above tables the p-value for the test of foreign withingrep78=3 is: p=0.3965Now using -margin, post- follow by -test- for the same comparison(i.e. foreign withing rep78=3):. margins ,over(rep78 foreign) post cformat(%5.2f) Predictive margins Number of obs = 69 Expression : Linear prediction, predict() over : rep78 foreign ------------------------------------------------------------------------------- | Delta-method| Margin Std. Err. z P>|z| [95%Conf. Interval]--------------+---------------------------------------------------------------- rep78#foreign |30 | 6358.41 490.77 12.96 0.000 5396.51 7320.3031 | 4828.67 1723.54 2.80 0.005 1450.60 8206.7440 | 5881.56 995.08 5.91 0.000 3931.23 7831.8941 | 6261.44 995.08 6.29 0.000 4311.11 8211.7750 | 4204.50 2110.89 1.99 0.046 67.22 8341.7851 | 6292.67 995.08 6.32 0.000 4342.34 8243.00------------------------------------------------------------------------------- . test 0.foreign#3.rep78=1.foreign#3.rep78 ( 1) 3bn.rep78#0bn.foreign - 3bn.rep78#1.foreign = 0 chi2( 1) = 0.73 Prob > chi2 = 0.3933I get a different p-value. Although close in this example, inanother case that have the p-values are further apart: (0.0026 vs 0.0089).Why are these two methods giving different answers? Thank you, Ricardo Ricardo Ovaldia, MS Statistician Oklahoma City, OK * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

------------------------------------------- Richard Williams, Notre Dame Dept of Sociology OFFICE: (574)631-6668, (574)631-6463 HOME: (574)289-5227 EMAIL: Richard.A.Williams.5@ND.Edu WWW: http://www.nd.edu/~rwilliam * * For searches and help try: * http://www.stata.com/help.cgi?search * http://www.stata.com/support/statalist/faq * http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**Re: st: difference between -test- and -contrast- in Statat 12***From:*Ricardo Ovaldia <ovaldia@yahoo.com>

**References**:**Re: st: Gestures in Stata 12 for Mac***From:*cnguyen@stata.com

**st: difference between -test- and -contrast- in Statat 12***From:*Ricardo Ovaldia <ovaldia@yahoo.com>

- Prev by Date:
**Re: st: command stata** - Next by Date:
**st: hazard curve** - Previous by thread:
**st: difference between -test- and -contrast- in Statat 12** - Next by thread:
**Re: st: difference between -test- and -contrast- in Statat 12** - Index(es):