thank you very much for your suggestion! 

I tried to do that with the psf I need to use: the 3 parameters Lognormal. I
did that with a single xstar and a single triplet of parameters  to check it
works.[I put some numbers to make it woks , but actually they comes from
statistical analysis]

/# these are the 3 parameters
a<- 414.566
b<- 345.5445
g<- -0.9695679
xstar<- 1397.923
#I create a vector
pars <-expand.grid(xstar = xstar, a= a, b= b , g= g) 
fun <- function(xstar, a,b,g,k) { 
    f <- function(x, xstar, a, b,g,k) f.lognorm(x) * k * x * (x >= xstar) 
    integrate(f, -Inf, Inf, xstar = xstar, a = a, b =b, g=g, k=k)$value 
   } 
# Method 1: (outputs a data frame) 
library(plyr) 
out <- mdply(pars, fun)/ 

at this stage a warning message comes out: *Errore in k > -1e-07 : 'k' is
missing*

Any ideas of why this error come out ? I really don' know.....
Moreover , can I use the algorithm suggested  iteratively by using  a grid
of xstar values and different triplets of parameters ( instead of different
value of k) ?

Thank you so much for any help!! 


--
View this message in context: 
http://r.789695.n4.nabble.com/Numerical-integration-tp3634365p3637092.html
Sent from the R help mailing list archive at Nabble.com.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to