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 |
"Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu> |

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

Subject |
RE: AW: st: sort of standardization |

Date |
Thu, 13 May 2010 08:20:09 -0700 |

That isn't a range, as you indicate - it's the number of days of hospitalization or the length of an episode. Tony Peter A. Lachenbruch Department of Public Health Oregon State University Corvallis, OR 97330 Phone: 541-737-3832 FAX: 541-737-4001 -----Original Message----- From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Joseph Coveney Sent: Thursday, May 13, 2010 7:08 AM To: statalist@hsphsun2.harvard.edu Subject: Re: AW: st: sort of standardization I'm not trying to side with Rich on this, but I know of at least one other area where such a formula is used for a range--or at least a range-like concept--and is not intended to indicate cardinality: in medical research, length of hospital stay is defined as discharge date - admittance (admission) date + 1 and duration of an episode of a drug side effect is apparently defined in some quarters as recovery time - onset time + 1 See http://stata.com/statalist/archive/2002-12/msg00262.html and http://www.stata.com/statalist/archive/2003-05/msg00433.html Joseph Coveney -------------------------------------------------------------------------------- For sure, but who (else) calls this the range? That's just (a version of) the number of distinct values. In some moods, or in some circles, many of us would call it the cardinality. A version of, because to spell out the obvious, even with integers there are at least three definitions that need not give the same numerical answer: 1. Number of distinct values observed. 2. Number of distinct values possible in principle. 3. max - min + 1. Otherwise put, are we talking different terminology or different concepts? Nick n.j.cox@durham.ac.uk Lachenbruch, Peter I think Rich is thinking of the number of distinct integers between 1 and 10, while the range is generally defined as the largest minus the smallest. Nick Cox The word "range" is surely ambiguous, although the ambiguity does not bite hard. I have no difficulty in saying both that the range is the interval [1,10] and that the range is the difference 9. Does that differ from Rich's view? Nick n.j.cox@durham.ac.uk Richard Goldstein look at it this way -- if my min is 1 and my max is 10, then the range is 10 (it seems to me), not 9 -- i.e., I think of the range as the min to the max *inclusive* of each endpoint; StataCorp apparently disagrees ;-) On 5/12/10 10:46 AM, Martin Weiss wrote: > " local range=r(max)-r(min)+1" > > Rich, what does the "+1" term do for the "range"? I took the definition in > my code from [R], page 204. Am I missing anything? Richard Goldstein > if I understand correctly what you want, I would do the following within > a -foreach- loop: > > summarize variable > calculate the range from r(min) and r(max) > divide the old variable by this calculated range inside a -gen- > > e.g., > > foreach var of varlist .... { > qui su `var' > local range=r(max)-r(min)+1 > gen `var'3=`var'/`range' > } > On 5/12/10 10:29 AM, Ginevra Biino wrote: >> I have to standardize many variables (in order to run PCA). >> Besides generating the n corresponding std(varname) vars, which I have >> already done, I also want to generate n new variables obtained dividing >> each variable by its range. Can anybody help me? * * 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/ * * 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/ * * 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: AW: st: sort of standardization***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: sort of standardization***From:*Ginevra Biino <biino@igm.cnr.it>

**Re: st: sort of standardization***From:*Richard Goldstein <richgold@ix.netcom.com>

**AW: st: sort of standardization***From:*"Martin Weiss" <martin.weiss1@gmx.de>

**Re: AW: st: sort of standardization***From:*Richard Goldstein <richgold@ix.netcom.com>

**RE: AW: st: sort of standardization***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**RE: AW: st: sort of standardization***From:*"Lachenbruch, Peter" <Peter.Lachenbruch@oregonstate.edu>

**RE: AW: st: sort of standardization***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: AW: st: sort of standardization***From:*"Joseph Coveney" <jcoveney@bigplanet.com>

- Prev by Date:
**st: RE: RE: RE: RE: RE: Stata stuck in loop with -rndpoi-?** - Next by Date:
**st: RE: RE: RE: RE: RE: RE: Stata stuck in loop with -rndpoi-?** - Previous by thread:
**Re: AW: st: sort of standardization** - Next by thread:
**RE: AW: st: sort of standardization** - Index(es):