Re: [R] expm() within the Matrix package

2007-03-19 Thread Martin Maechler
Gad == Gad Abraham [EMAIL PROTECTED] on Mon, 19 Mar 2007 09:36:15 +1100 writes: Gad If you convert to numeric, you can then assign it to Loglik: Loglik[1] - as.numeric(log(p %*% expm(Q * y[i]) %*% q)) Loglik[1] Gad [1] 134.5565 Hmm, I don't think that's

Re: [R] expm() within the Matrix package

2007-03-18 Thread Gad Abraham
Gad If you convert to numeric, you can then assign it to Loglik: Loglik[1] - as.numeric(log(p %*% expm(Q * y[i]) %*% q)) Loglik[1] Gad [1] 134.5565 Hmm, I don't think that's Laura's problem (and actually I don't know what her problem is) : Assignment of a 1 x 1

Re: [R] expm() within the Matrix package

2007-03-16 Thread Martin Maechler
Gad == Gad Abraham [EMAIL PROTECTED] on Fri, 16 Mar 2007 09:48:52 +1100 writes: Gad Laura Hill wrote: Hi Could anybody give me a bit of advice on some code I'm having trouble with? I've been trying to calculate the loglikelihood of a function iterated over

Re: [R] expm() within the Matrix package

2007-03-16 Thread Martin Maechler
Gad == Gad Abraham [EMAIL PROTECTED] on Fri, 16 Mar 2007 09:48:52 +1100 writes: Gad Laura Hill wrote: Hi Could anybody give me a bit of advice on some code I'm having trouble with? I've been trying to calculate the loglikelihood of a function iterated over

[R] expm() within the Matrix package

2007-03-15 Thread Laura Hill
Hi Could anybody give me a bit of advice on some code I'm having trouble with? I've been trying to calculate the loglikelihood of a function iterated over a data of time values and I seem to be experiencing difficulty when I use the function expm(). Here's an example of what I am trying to do

Re: [R] expm() within the Matrix package

2007-03-15 Thread Gad Abraham
Laura Hill wrote: Hi Could anybody give me a bit of advice on some code I'm having trouble with? I've been trying to calculate the loglikelihood of a function iterated over a data of time values and I seem to be experiencing difficulty when I use the function expm(). Here's an example of

[R] expm()

2007-03-06 Thread Laura Hill
Can the expm function be used to calculate the exponential of a matrix where the matrix is multiplied by a vector in a data frame? For example for (i in 1:length(y)){ expmN-expm(Q*y[i]) Q-Matrix(c(1, 2, 3, 4), 2, 2) return(expmN) } Sorry I am new to R and I have been

Re: [R] expm()

2007-03-06 Thread Douglas Bates
On 3/6/07, Laura Hill [EMAIL PROTECTED] wrote: Can the expm function be used to calculate the exponential of a matrix where the matrix is multiplied by a vector in a data frame? I don't quite understand the question. The exponential of a matrix is only defined for square matrices. For