Displaying 4 results from an estimated 4 matches for "lhill07".
Did you mean:
lhill
2007 Mar 06
2
Estimating parameters of 2 phase Coxian using optim
...th(y)){
loglik<-log(p %*% expm(Q * y(i)) %*% q)
return(loglik)}
sumloglik<-sum(loglik)
return(-sumloglik)
}
I have installed the Matrix package. y is a vector of 240 survival times. In
the R console I typed
> source("/private/var/automount/users/lhill07/Desktop/cox2.lik.R")
> optim(c(0.5, 0.5, 0.5), cox2.lik, y=y, method="BFGS")
Error: could not find function "y"
Error in expm(Q * y(i)) : error in evaluating the argument 'x' in selecting
a method for function 'expm'
Error in log(p %*% expm(Q * y(i))...
2007 Mar 06
1
expm()
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 finding it difficult to get information
on calculating Matrix exponentials in R.
Many thanks in
2007 Mar 13
0
multiplying matrix by vector of times
On 8/3/07 22:12, "Gad Abraham" <g.abraham at ms.unimelb.edu.au> wrote:
> Laura Hill wrote:
>>
>>
>> On 7/3/07 00:15, "Gad Abraham" <g.abraham at ms.unimelb.edu.au> wrote:
>>
>>>> On 6 Mar 2007, at 08:54, Laura Hill wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> My name is
2007 Mar 15
1
expm() within the Matrix package
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
y<-c(5,10) #vector of 2 survival times
p<-Matrix(c(1,0),1,2) #1x2 matrix