Displaying 1 result from an estimated 1 matches for "getpred".
Did you mean:
getprev
2011 Aug 17
2
An example of very slow computation
...-2,-2,-2)
nlogL<-function(theta){
k<-exp(theta[1:3])
sigma<-exp(theta[4])
A<-rbind(
c(-k[1], k[2]),
c( k[1], -(k[2]+k[3]))
)
x0<-c(0,100)
sol<-function(t)100-sum(expm(A*t)%*%x0)
pred<-sapply(dat[,1],sol)
-sum(dnorm(dat[,2],mean=pred,sd=sigma, log=TRUE))
}
getpred<-function(theta, t){
k<-exp(theta[1:3])
sigma<-exp(theta[4])
A<-rbind(
c(-k[1], k[2]),
c( k[1], -(k[2]+k[3]))
)
x0<-c(0,100)
sol<-function(tt)100-sum(expm(A*tt)%*%x0)
pred<-sapply(t,sol)
}
Mpred <- function(theta) {
# WARNING: assumes t global
kvec<-exp...