Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down at the end of May, and its replacement, statalist.org is already up and running.


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

st: Collecting ttest results using parmby, factext, metaparm


From   David Scharff <chatsworth72@gmail.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Collecting ttest results using parmby, factext, metaparm
Date   Tue, 13 Sep 2011 10:46:54 +0200

Dear all

I need to collect the results of a series of ttests (equal variances),
store them in a file together with their p-values. In a second step, I
want to plot the means of the variables with CI’s using ECLplot. I’m
using Roger Newson’s parmby, factext and metaparm commands. This is my
code. I cannot manage to get factext working it seems, but I do not
figure out where my mistake is. As is obvious, I'm not very
experienced in programming Stata. (I use Stata 12 if this is
relevant).

global tflist ""
global modseq=0
foreach X of var sem_a sem_b {
global modseq=$modseq+1
tempfile tf$modseq temp1
descsave, do(`temp1', replace)
ttest `X', by(case)
parmby "xi, noomit: regress `X' i.case, noconst", label
format(estimate min* max* %8.2f p %-8.2g) idn($modseq)
saving(`tf$modseq',replace) flist(tflist)
factext, do(`temp1')
metaparm [iwei=!case-case], dfcombine(constant) saving(`tf$modseq',replace)
}
dsconcat $tflist

The same, adapted to the auto data for easier inspection:
sysuse auto, clear
global tflist ""
global modseq=0
foreach X of var weight length {
global modseq=$modseq+1
tempfile tf$modseq temp1
descsave, do(`temp1', replace)
ttest `X', by(foreign)
parmby "xi, noomit: regress `X' i.foreign, noconst", label
format(estimate min* max* %8.2f p %-8.2g) idn($modseq)
saving(`tf$modseq',replace) flist(tflist)
factext, do(`temp1')
metaparm [iwei=!foreign-foreign], dfcombine(constant)
saving(`tf$modseq',replace)
}
dsconcat $tflist

Any help is greatly appreciated - I have spent hours finding my mistake now...
Many thanks in advance!!
David

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


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index