Thank you Giuseppe. As I said, very useful to know.
Cheers,
Artur
Am 31.07.2013 13:48, schrieb Giuseppe Vittucci:
It is an if condition on the single elements of a series
if (isnan(M[i]) = 1, i.e. the correspondent element of M is null) then
M[i] = 0 else
M[i] = M[i].
Bye
Giuseppe
On Wed, 2013-07-31 at 12:56 +0200, Artur T. wrote:
> This is great! Actually, I was looking for something like this for a
> while. Could anybody explain the single elements of this command,
> please? It does not look very intuitive to me. Or is there reference in
> the gretl guide on this?
>
> M = isnan(M) ? 0 : M
>
> Thank you.
> Artur
>
> Am 25.07.2013 11:28, schrieb Allin Cottrell:
>> On Tue, 23 Jul 2013, Logan Kelly wrote:
>>
>>> I need to take the log difference of a matrix, i.e. log(M[2
>>> rows(M):,]/M[1:rows(M)-1,]). Unfortunately, M has elements
>>> equal to zero. I need to replace the nan's and inf's with
>>> 0's. This almost works
>>>
>>> M = isnan(M) ? 0 : M
>>>
>>> but does not remove inf's. Any sugestions?
>>
>> Is this calculation actually legit? Assuming it is, then
>>
>> <hansl>
>> matrix M = muniform(15,2)
>> M[2,2] = 0
>> M[3,2] = 0
>> matrix ldM = log(M[2:rows(M),] - M[1:rows(M)-1,])
>> ldM = isnan(0 * ldM) ? 0 : ldM
>> print M ldM
>> </hansl>
>>
>> This relies on the IEEE 754 rules: both 0*inf and 0*(-inf)
>> return nan.
>>
>> Allin Cottrell
>> _______________________________________________
>> Gretl-users mailing list
>> Gretl-users(a)lists.wfu.edu
>>
http://lists.wfu.edu/mailman/listinfo/gretl-users
>>
>
_______________________________________________
Gretl-users mailing list
Gretl-users(a)lists.wfu.edu
http://lists.wfu.edu/mailman/listinfo/gretl-users
--
Jabber account: t.artur(a)ubuntu-jabber.de
Join me on Diaspora: ArturT(a)kosmospora.net
(Invitation to Diaspora:
kosmospora.net/i/94ce021fe957
You would like to send an encrypted PGP message?
-----BEGIN PGP PUBLIC KEY BLOCK-----
Version: GnuPG v1.4.12 (GNU/Linux)
mQENBFHqSQABCADvcNkANqF9klVT4o0X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