[R] Error in 1/ue : non-numeric argument to binary operator.
beiyu
beiyulin at gmail.com
Wed Oct 19 07:11:32 CEST 2011
hi, I have a problem. The R shows that
Error in 1/ue : non-numeric argument to binary operator.
Here is the code:
# simulation of tempered stable processes by compound Poisson approximation
tsp<-function(n,e,a,c,lema){
x<-numeric(n)
for (i in 1:n){
repeat{
w<-runif(1)
v<-runif(1)
x<-e*(w^(-1/a))
fex<-function(x1){ if (x1>=e) {a1<-a*(e^(-a))/(x^a-1)}}
vex<-function(x2){c*exp(-lema*x2)/(x2^(a+1))}
ue<-integrate(vex,e,Inf)
aa<-(1/ue)*c
pex<-function(x3){aa*exp(-lema*x3)/(x3^(a+1))}
if (x>=e) {pex(x)}
T<-fex(x)*(e^(-a))*(exp(-lema*e))/(pex(x)*a*ue)
if(V*T<=1) break
if (ue<=2) break
}
x
}
}
tsp(10,0.01,1.5,1,10)
Could any one help me? Thx~
--
View this message in context: http://r.789695.n4.nabble.com/Error-in-1-ue-non-numeric-argument-to-binary-operator-tp3917605p3917605.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list