Matrix computation in some logarithmic transformations

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Matrix computation in some logarithmic transformations

Super3
Dear listers
I need a help in the next problem:
I have to compute logarithms in the example below where there are zeroes
end the intention is to retain zeroes after logarithmic transformation
as they are (because of impossible transformations):

data list free/y1 to y5.
Begin data.
4 0 7 8 9
6 2 0 0 1000
60 8 9 100 0
End data.
list.

Matrix.
Get y /Variables=y1 to y5.
Compute LOGY=LN(y).
End Matrix.

After running the above code the result is as next:
>Value for LN is out of range.>This command not excuted.
Reply | Threaded
Open this post in threaded view
|

Re: Matrix computation in some logarithmic transformations

Marta García-Granero
Hi "super3" (could I have your name, please? I like to address people
correctly)

The solution is quite easy: if you recode all 0 into system missing
before starting matrix, you can tell the program to replace them by 1.
Since Log(1)=0, you will retain the original 0 values. If you use
TEMPORARY, your original dataset will remain unchanged:

data list free/y1 to y5.
Begin data.
4 0 7 8 9
6 2 0 0 1000
60 8 9 100 0
End data.

TEMPORARY.
RECODE y1 TO y5 (0=SYSMIS)  .

Matrix.
Get y /Variables=y1 to y5
      /MISSING=ACCEPT /SYSMIS=1.
Compute LOGY=LN(y).
PRINT logy.
End Matrix.

S> I have to compute logarithms in the example below where there are zeroes
S> end the intention is to retain zeroes after logarithmic transformation
S> as they are (because of impossible transformations):

S> data list free/y1 to y5.
S> Begin data.
S> 4 0 7 8 9
S> 6 2 0 0 1000
S> 60 8 9 100 0
S> End data.
S> list.

S> Matrix.
S> Get y /Variables=y1 to y5.
S> Compute LOGY=LN(y).
S> End Matrix.

S> After running the above code the result is as next:
>>Value for LN is out of range.>This command not excuted.

--
Regards,
Dr. Marta García-Granero,PhD           mailto:[hidden email]
Statistician

---
"It is unwise to use a statistical procedure whose use one does
not understand. SPSS syntax guide cannot supply this knowledge, and it
is certainly no substitute for the basic understanding of statistics
and statistical thinking that is essential for the wise choice of
methods and the correct interpretation of their results".

(Adapted from WinPepi manual - I'm sure Joe Abrahmson will not mind)
Reply | Threaded
Open this post in threaded view
|

Matrix computation in some logarithmic transformations

Super3
Dear Marta
Thanks once again for your help in this 'Matrix' problem. The solution works perfectly, as this is the case with all your suggestions.
My Best regards
E. Kazazis


-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Marta Garcia-Granero
Sent: Wednesday, May 16, 2007 2:06 PM
To: [hidden email]
Subject: Re: Matrix computation in some logarithmic transformations

Hi "super3" (could I have your name, please? I like to address people
correctly)

The solution is quite easy: if you recode all 0 into system missing
before starting matrix, you can tell the program to replace them by 1.
Since Log(1)=0, you will retain the original 0 values. If you use
TEMPORARY, your original dataset will remain unchanged:

data list free/y1 to y5.
Begin data.
4 0 7 8 9
6 2 0 0 1000
60 8 9 100 0
End data.

TEMPORARY.
RECODE y1 TO y5 (0=SYSMIS)  .

Matrix.
Get y /Variables=y1 to y5
      /MISSING=ACCEPT /SYSMIS=1.
Compute LOGY=LN(y).
PRINT logy.
End Matrix.

S> I have to compute logarithms in the example below where there are zeroes
S> end the intention is to retain zeroes after logarithmic transformation
S> as they are (because of impossible transformations):

S> data list free/y1 to y5.
S> Begin data.
S> 4 0 7 8 9
S> 6 2 0 0 1000
S> 60 8 9 100 0
S> End data.
S> list.

S> Matrix.
S> Get y /Variables=y1 to y5.
S> Compute LOGY=LN(y).
S> End Matrix.

S> After running the above code the result is as next:
>>Value for LN is out of range.>This command not excuted.

--
Regards,
Dr. Marta García-Granero,PhD           mailto:[hidden email]
Statistician

---
"It is unwise to use a statistical procedure whose use one does
not understand. SPSS syntax guide cannot supply this knowledge, and it
is certainly no substitute for the basic understanding of statistics
and statistical thinking that is essential for the wise choice of
methods and the correct interpretation of their results".

(Adapted from WinPepi manual - I'm sure Joe Abrahmson will not mind)
Reply | Threaded
Open this post in threaded view
|

Re: Matrix computation in some logarithmic transformations

Marta García-Granero
In reply to this post by Marta García-Granero
Hi E. Kazakis

Kalispera!

Thursday, May 17, 2007, 10:38:19 AM, You wrote:

S> Thanks once again for your help in this 'Matrix' problem. The
S> solution works perfectly, as this is the case with all your
S> suggestions

You are wellcome :)

S> Note:
S> This small little modification I think that gives the same results.

I thought you might need the original data for more computations than
the logarithms, and I didn't want to input irreversively modified data
into the MATRIX program (how would you see the diference between true
1 and the 0 turned into 1 in order to be able to back modify your data
for other computations?).

* See this, again, modified code *.

data list free/y1 to y5.
Begin data.
4 0 7 8 9
6 2 0 0 1000
60 8 9 100 0
End data.

TEMPORARY.
RECODE y1 TO y5 (0=SYSMIS)  .
MATRIX.
* Input data for log computing *.
Get y /Variables=y1 to y5
      /MISSING=ACCEPT /SYSMIS=1.
Compute LOGY=LN(y).
PRINT logy.
* Input data for different computation (not logs) *.
Get x /Variables=y1 to y5
      /MISSING=ACCEPT /SYSMIS=0.
PRINT x.
END MATRIX.

This way, you can import the original or 0-modified data, just in case
you needed both for any other fancy computations (besides logs).

Regards,
Marta Garcia-Granero