Hi All,
I have a problem to create a variable that is a function of an integral of
another function.
The problem is the following:
I have a variable called cip. I have to create another variable called bip
that is a function of the former variable cip and also the cumulative
distribution function of the variable cip.
Consider the equation below:
b_{i}\left(c_{i},F,I,p_{0}\right)=c_{i}+\frac{1}{\left[1-F\left(c_{i}\right)\right]^{I-1}}\int_{\overline{c}}^{1}\left[1-F\left(u\right)\right]^{I-1}du
In my case, the equation will be:
bip=cip+\frac{1}{\left[1-F\left(cip\right)\right]^{4}}\int_{cip}^{2,967}\left[1-F\left(u\right)\right]^{4}du
I am facing problem to create this variable bip because of the integral. I
am sure I am doing something wrong.
I used:
> fcdfcip <- ecdf(cip)
> f <- function(cip) (1 - fcdfcip)^4
> bip <- function(cip) cip + (1/f)*integrate(f,cip,2.967)
But when I ask for the summary of the variable bip, I find:
summary(bip)
Error in object[[i]] : object of type 'closure' is not subsettable
Sorry if I am doing any stupid thing, but I am really a bit lost with the
program. Do you have any hint?
Thank you in advance!
NGS
[[alternative HTML version deleted]]