[R] Different length of objects

From: <voodooochild_at_gmx.de>
Date: Sun 15 Jan 2006 - 02:08:43 EST


Hello,

i got an warning message in the following code:

f<-1:100
t<-1:100
b<-100

ll2 <- function(b,f,t) {
  t<-cumsum(t)
  tn<-t[length(t)]
  i<-seq(along=f)
  s1<-(tn*exp(-b*tn)*sum(f[i]))/(1-exp(-b*tn))   

s2<-sum((f[i]*(t[i]*exp(-b*t[i])-t[i-1]*exp(b*t[i-1])))/(exp(-b*t[i-1])-exp(-b*t[i])))   s1-s2
}

ll2(b,f,t)

i think, the problem here is, that t[0] doesn't exist and so i got different length of objects. want can i do to avoid this error? the assumption is that t[0] should be 0.

best regards
andreas



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sun Jan 15 02:17:34 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:04 EST