Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Re: RE: Re: Re: Multiple paired ttests


From   "Kaaresen Per Ivar" <Per.Ivar.Kaaresen@unn.no>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: RE: Re: Re: Multiple paired ttests
Date   Thu, 9 Sep 2004 11:57:03 +0200

Ikke sensitiv - Please ignore this message - due to in-house  security

Thank you, Nick.

Your first loop works perfectly for me.

Regards

Per Ivar

-----Opprinnelig melding-----
Fra: Nick Cox [mailto:n.j.cox@durham.ac.uk]
Sendt: 9. september 2004 11:38
Til: statalist@hsphsun2.harvard.edu
Emne: st: RE: Re: Re: Multiple paired ttests


Let's assume optimistically that the wildcard *mm 
includes all the variables you want on one side. 
You could do this: 

foreach m of var *mm { 
	local f = substr("`m'",1,length("`m'")-1) + "f" 
	ttest `m' == `f' 
} 

The first line in the loop could also be 

	local f = reverse(substr(reverse("`m'"),2,.)) + "f" 

but that's a bit of a backwards solution. You might 
also consider 

	local f : subinstr local m "mm" "mf" 

but that is more dangerous. 

The multiple comparisons issue of firing a shotgun 
in this way I leave on one side. 

Nick 
n.j.cox@durham.ac.uk 

Kaaresen Per Ivar
> 
> However, I now realize I was inaccurate in describing my variable
> names.In fact they are named
> 
> dimm atmm comm.......  and dimf atmf comf.......
> 
> and I want to cycle through
> 
> ttest dimm==dimf
> ttest atmm==atmf
> 
> and so forth. Sorry for this. Any ideas?

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

*
*   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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index