Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Wendy Alfaro <wendyalfaro07@gmail.com> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Re: ANOVA |
Date | Thu, 6 Mar 2014 19:05:53 -0600 |
Thank you so much. My study is about measuring some variables (texture, color, etc) in muffins made out of gluten free flour. I use four treatments and three repetitions for each treatment. Thank you, On Thu, Mar 6, 2014 at 6:56 PM, Joseph Coveney <stajc2@gmail.com> wrote: > Wendy Alfaro wrote: > > I need to run and Anova with these data. How do I perform the test with Stata? > > Dureza primer mordisco > Tratamiento (Sust. Huevo)% Muestra 1 Muestra 2 Muestra 3 > 1.1 1.2 1.3 2.1 2.2 2.3 3.1 3.2 3.3 > 100% 29,7562 35,0566 32,8892 19,9594 28,9730 22,3698 37,4985 31,2923 31,8955 > 75% 22,3752 27,6344 30,8096 22,0975 22,4783 28,2321 27,9858 25,2717 21,7764 > 50% 25,9648 29,3983 26.9672 30,4386 27,0703 31,4941 43,7090 62,9589 44,2992 > 0% 24,8714 24,0784 28,6552 33,1658 33,7440 33,9544 20,8814 24,6869 19,3974 > I need to run and Anova with these data. How do I perform the test with Stata? > > Dureza segundo mordisco > Tratamiento (Sust. Huevo)% Muestra 1 Muestra 2 Muestra 3 > 1.1 1.2 1.3 2.1 2.2 2.3 3.1 3.2 3.3 > 100% 20,0689 25,8021 21,6245 15,8371 21,7363 17,6238 29,5198 25,1263 25,4528 > 75% 15,3175 19,0080 22,3080 17,3005 19,1132 20,8489 23,4535 21,6940 19,2889 > 50% 18,8561 22,0628 19,1392 22,9024 21,7797 26,4107 34,7594 50,0161 36,8400 > 0% 19,5395 17,8472 23,7215 28,3482 27,5487 28,6693 18,2164 20,9888 16,1398 > > Dureza, pico negativo de elasticidad del primer pico > Tratamiento (Sust. Huevo)% Muestra 1 Muestra 2 Muestra 3 > 1.1 1.2 1.3 2.1 2.2 2.3 3.1 3.2 3.3 > 100% -0,0409 -0,0499 -0,1909 -0,0835 -0,1052 -0,0282 -0,1182 -0,1367 -0,0488 > 75% -0,0824 -0,1410 -0,0184 -0,0846 -0,0239 -0,0998 0,0033 -0,0759 0,0141 > 50% -0,0358 -0,0955 -0,0108 -0,0054 -0,0184 0,0011 -0,0098 -0,0749 -0,0098 > 0% -0,0228 -0,0152 -0,0011 -0,0033 -0,0521 0 -0,0054 0,0087 0 > > Dureza, pico negativo de elasticidad del segundo pico > Tratamiento (Sust. Huevo)% Muestra 1 Muestra 2 Muestra 3 > 1.1 1.2 1.3 2.1 2.2 2.3 3.1 3.2 3.3 > 100% -0,1258 -0,0911 -0,0949 -0,0879 -0,0868 -0,0358 -0,1345 -0,0868 -0,1009 > 75% -0,0683 -0,0087 -0,0477 -0,0792 -0,0184 -0,1041 -0,0759 -0,0694 -0,0629 > 50% -0,0250 -0,1041 -0,0065 0 -0,0022 -0,0597 -0,0477 -0,0239 -0,0184 > 0% -0,0011 -0,0119 -0,0466 -0,0553 0,0499 -0,0510 0,0065 -0,0304 -0,0108 > > -------------------------------------------------------------------------------- > > Try something like that below. I show the MANCOVA table beneath the do-file. > > I have no idea what your study is all about (for example, for the sake of data > input, es. mordisco => Eng. bite), or whether the pair of paired datasets is > supposed to represent two outcome variables for common explanatory variables. > But MANCOVA is always more fun to me than ANOVA, so that's how I set it up. > > Joseph Coveney > > clear * > set more off > // Nota bene: "hard-coded" correction of data-entry error: 26.9672 -> 26,9672 > quietly input str244 a1-a30 > 100% 29,7562 35,0566 32,8892 19,9594 28,9730 22,3698 37,4985 31,2923 31,8955 > 75% 22,3752 27,6344 30,8096 22,0975 22,4783 28,2321 27,9858 25,2717 21,7764 > 50% 25,9648 29,3983 26,9672 30,4386 27,0703 31,4941 43,7090 62,9589 44,2992 > 0% 24,8714 24,0784 28,6552 33,1658 33,7440 33,9544 20,8814 24,6869 19,3974 > end > > generate byte bite = 1 > tempfile tmpfil0 > quietly save `tmpfil0' > > drop _all > quietly input str244 a1-a30 > 100% 20,0689 25,8021 21,6245 15,8371 21,7363 17,6238 29,5198 25,1263 25,4528 > 75% 15,3175 19,0080 22,3080 17,3005 19,1132 20,8489 23,4535 21,6940 19,2889 > 50% 18,8561 22,0628 19,1392 22,9024 21,7797 26,4107 34,7594 50,0161 36,8400 > 0% 19,5395 17,8472 23,7215 28,3482 27,5487 28,6693 18,2164 20,9888 16,1398 > end > > generate byte bite = 2 > append using `tmpfil0' > generate long h11 = real(a3 + a5) > generate long h12 = real(a6 + a8) > generate long h13 = real(a9 + a11) > generate long h21 = real(a12 + a14) > generate long h22 = real(a15 + a17) > generate long h23 = real(a18 + a20) > generate long h31 = real(a21 + a23) > generate long h32 = real(a24 + a26) > generate long h33 = real(a27 + a29) > destring a1, generate(trt) > drop a* > quietly save `tmpfil0', replace > > drop _all > // Nota bene: "hard-coded" correction of data format inconsistency > quietly input str244 a1-a30 > 100% -0,0409 -0,0499 -0,1909 -0,0835 -0,1052 -0,0282 -0,1182 -0,1367 -0,0488 > 75% -0,0824 -0,1410 -0,0184 -0,0846 -0,0239 -0,0998 0,0033 -0,0759 0,0141 > 50% -0,0358 -0,0955 -0,0108 -0,0054 -0,0184 0,0011 -0,0098 -0,0749 -0,0098 > 0% -0,0228 -0,0152 -0,0011 -0,0033 -0,0521 0,0000 -0,0054 0,0087 0,0000 > end > > generate byte bite = 1 > tempfile tmpfil1 > quietly save `tmpfil1' > > drop _all > // Nota bene: "hard-coded" correction of data format inconsistency > quietly input str244 a1-a30 > 100% -0,1258 -0,0911 -0,0949 -0,0879 -0,0868 -0,0358 -0,1345 -0,0868 -0,1009 > 75% -0,0683 -0,0087 -0,0477 -0,0792 -0,0184 -0,1041 -0,0759 -0,0694 -0,0629 > 50% -0,0250 -0,1041 -0,0065 0,0000 -0,0022 -0,0597 -0,0477 -0,0239 -0,0184 > 0% -0,0011 -0,0119 -0,0466 -0,0553 0,0499 -0,0510 0,0065 -0,0304 -0,0108 > end > > generate byte bite = 2 > append using `tmpfil1' > generate long enp11 = real(a3 + a5) > generate long enp12 = real(a6 + a8) > generate long enp13 = real(a9 + a11) > generate long enp21 = real(a12 + a14) > generate long enp22 = real(a15 + a17) > generate long enp23 = real(a18 + a20) > generate long enp31 = real(a21 + a23) > generate long enp32 = real(a24 + a26) > generate long enp33 = real(a27 + a29) > destring a1, generate(trt) > drop a* > > merge 1:1 trt bite using `tmpfil0', assert(match) nogenerate noreport > quietly reshape long enp1 enp2 enp3 h1 h2 h3, i(trt bite) j(reading) > quietly reshape long enp h, i(trt bite reading) j(sample) > rename h hard > manova enp hard = trt bite trt#bite / sample|trt#bite /// > reading trt#reading bite#reading trt#bite#reading > > exit > > MANCOVA table, copied and pasted from Results Window: > > Number of obs = 72 > > W = Wilks' lambda L = Lawley-Hotelling trace > P = Pillai's trace R = Roy's largest root > > Source | Statistic df F(df1, df2) = F Prob>F > -----------------+-------------------------------------------------- > Model | W 0.0402 39 78.0 62.0 3.17 0.0000 e > | P 1.5274 78.0 64.0 2.65 0.0000 a > | L 9.7576 78.0 60.0 3.75 0.0000 a > | R 7.9899 39.0 32.0 6.56 0.0000 u > |-------------------------------------------------- > Residual | 32 > -----------------+-------------------------------------------------- > trt | W 0.1393 3 6.0 30.0 8.40 0.0000 e > | P 1.0668 6.0 32.0 6.10 0.0002 a > | L 4.7005 6.0 28.0 10.97 0.0000 a > | R 4.3612 3.0 16.0 23.26 0.0000 u > |-------------------------------------------------- > bite | W 0.7214 1 2.0 15.0 2.90 0.0864 e > | P 0.2786 2.0 15.0 2.90 0.0864 e > | L 0.3861 2.0 15.0 2.90 0.0864 e > | R 0.3861 2.0 15.0 2.90 0.0864 e > |-------------------------------------------------- > trt#bite | W 0.9862 3 6.0 30.0 0.03 0.9998 e > | P 0.0139 6.0 32.0 0.04 0.9997 a > | L 0.0140 6.0 28.0 0.03 0.9998 a > | R 0.0121 3.0 16.0 0.06 0.9779 u > |-------------------------------------------------- > sample|trt#bite | 16 > -----------------+-------------------------------------------------- > reading | W 0.8531 2 4.0 62.0 1.28 0.2869 e > | P 0.1493 4.0 64.0 1.29 0.2831 a > | L 0.1694 4.0 60.0 1.27 0.2915 a > | R 0.1510 2.0 32.0 2.42 0.1053 u > |-------------------------------------------------- > trt#reading | W 0.8122 6 12.0 62.0 0.57 0.8607 e > | P 0.1917 12.0 64.0 0.57 0.8616 a > | L 0.2264 12.0 60.0 0.57 0.8606 a > | R 0.2025 6.0 32.0 1.08 0.3950 u > |-------------------------------------------------- > bite#reading | W 0.8767 2 4.0 62.0 1.05 0.3868 e > | P 0.1233 4.0 64.0 1.05 0.3880 a > | L 0.1406 4.0 60.0 1.05 0.3868 a > | R 0.1406 2.0 32.0 2.25 0.1218 u > |-------------------------------------------------- > trt#bite#reading | W 0.9159 6 12.0 62.0 0.23 0.9960 e > | P 0.0846 12.0 64.0 0.24 0.9957 a > | L 0.0914 12.0 60.0 0.23 0.9962 a > | R 0.0859 6.0 32.0 0.46 0.8339 u > |-------------------------------------------------- > Residual | 32 > -----------------+-------------------------------------------------- > Total | 71 > -------------------------------------------------------------------- > e = exact, a = approximate, u = upper bound on F > > . > . exit > > end of do-file > > * > * 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/ -- Wendy Gabriela Alfaro Chaves Consultora e investigadora Desarrollo sostenible Tel: (506) 2494-3647 Correo-e: wendyalfaro07@gmail.com Skype: wendy07 * * 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/