Clive,
Kit Baum answered this question last week:
"As your 7th grade algebra teacher probably told you,
z = x/2 + 5 will take x {-10,10} into the range {0, 10}.
set obs 21
g x = -11 + _n
g z = x/2 + 5
list"
In this case the transformation is z = (x + 1)/2.
clear
set obs 41
g x = (-21 + _n)/20
g z = (x + 1)/2
list
Scott
> -----Original Message-----
> From: [email protected] [mailto:owner-
> [email protected]] On Behalf Of Clive Nicholas
> Sent: Friday, July 15, 2005 1:40 AM
> To: [email protected]
> Subject: st: Can I convert (-1-+1) variables into (0-1) variables?
>
> Windows 2000
>
> Does anybody know of a sound, tried and tested method in Stata of
> converting (net) variables which take a value-range of -1 (thru 0) to +1
> into (gross) variables that take a value-range of 0 to 1 only, such that
>
> . l
> +--------------+
> | net gross |
> |--------------|
> 1. | -1 0 |
> 2. | -.75 .125 |
> 3. | -.5 .25 |
> 4. | -.25 .375 |
> 5. | 0 .5 |
> |--------------|
> 6. | .25 .625 |
> 7. | .5 .75 |
> 8. | .75 .875 |
> 9. | 1 1 |
> +--------------+
>
> and so on.
>
> Clearly, the solution is not some sort of simple scale ratio (if only).
> Indeed, it may not be a Stata solution and more of a mathematical one. I
> have fired up
>
> . twoway line gross net, xlabel(-1(.1)1) ylabel(0(.1)1)
>
> to make a crude inspection of which net values equates which gross values
> (so I know that -.4 = 3, for example), but I need greater precision than
> this. Given that many of my values take five or six decimal places (e.g.,
> -0.486854), it's impossible to work out all the equivalents!
>
> Any thoughts, Statalisters?
>
> CLIVE NICHOLAS |t: 0(044)7903 397793
> Politics |e: [email protected]
> Newcastle University |http://www.ncl.ac.uk/geps
>
> Whereever you go and whatever you do, just remember this. No matter how
> many like you, admire you, love you or adore you, the number of people
> turning up to your funeral will be largely determined by local weather
> conditions.
>
> *
> * 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/