[R] Need help

Md. Moyazzem Hossain ho@@@|nmm @end|ng |rom jun|v@edu
Thu Aug 4 15:30:35 CEST 2022


Dear R Experts,

I hope that you are doing well.

I am facing a problem to find out the value of the following function. I
need help in this regard.

#####
a=rnorm(1000, 110, 5)
b = rnorm(1000, -0.3, 0.4)
s = length(a)
lam=0.15
thr=70
r= 10

ff = function(zz){
  inner = vector("numeric", length = s)
     for(k in 1:s){
      inner[k]=(1- lam*((1+b[k]*((zz-thr)/a[k]))^(-1/b[k])))
          }
  answer = mean(inner)- (1- (1/r))
  return(answer)
  }
########
out=uniroot(ff, lower = 0, upper = 10000 )$root
out

########### Error ########
Error in uniroot(ff, lower = 0, upper = 10000) :
  f.upper = f(upper) is NA

Please help me. Thanks in advance.

Take care.

Hossain

-- 
Best Regards,
Md. Moyazzem Hossain
Associate Professor
Department of Statistics
Jahangirnagar University
Savar, Dhaka-1342, Bangladesh

	[[alternative HTML version deleted]]



More information about the R-help mailing list