Many thanks Ellison I have modified it as you suggested but I have this error message <<<Error in f(lower, ...) : unused argument(s) (N = 54) >>> I am not sure which arguments I have missed? *y <- function(t,n){ diff <- 0.5 df1 <- 2*n-2 ncp1 <- sqrt((diff^2*n)/2) p <- 1- pt(t,df=df1) test <- qt((1-p),df=df1,ncp=ncp1)*(1/sqrt(2)) return(test) }
integ <- function(n){ 1-integrate(y,lower=0,upper=2.7,n)$value -0.8 } uniroot(integ,lower=0,upper=1000,N=n) traceback()* -- View this message in context: http://r.789695.n4.nabble.com/Uniroot-error-message-with-in-intergration-tp4634247p4634278.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.