[R] function of an integral
Wu Gong
wg2f at mtmail.mtsu.edu
Wed Jul 21 06:17:22 CEST 2010
Hi,
I'm trying to replicate your program. It may be not the same as yours, hope
it helps.
## Create a vector of numbers
cip <- seq(1.0,2.5,by=0.1)
## Create ecdf function
Fn <- ecdf(cip)
## Create f function
f <- function(x){(1-Fn(x))^4}
## Create integrate function
## Because the integrate function is not vectorized
fi <- function(f,x) {
res <- numeric(length(x))
for(i in 1:length(x)){res[i] <- integrate(f,x[i],2.967)$value}
res}
## The final results
bip <- cip + (1/f(cip))*fi(f,cip)
-----
A R learner.
--
View this message in context: http://r.789695.n4.nabble.com/function-of-an-integral-tp2296470p2296577.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list