[R] Different length of objects

voodooochild@gmx.de voodooochild at gmx.de
Sat Jan 14 16:08:43 CET 2006


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




More information about the R-help mailing list