# [R] help me to debug this part of code?

From: jinjin <hj_suzhou_at_hotmail.com>
Date: Fri, 18 Apr 2008 08:05:07 -0700 (PDT)

my code is below, I don't know why R keep telling me the syntax wrong but I am not clear, thanks.

f<-function(u,k){(1+u^2/(k-1))^(-k/2)}
g<-function(u,k){(1+u^2/k)^(-(k+1)/2)}

for(k in 4:25){
out<-uniroot(function(a){
m<-exp(lgamma(k/2)-lgamma((k-1)/2))*1/sqrt(k-1) n<-exp(lgamma((k+1)/2)-lgamma(k/2)*1/sqrt(k) m*integrate(f,lower=0,upper=sqrt(a^2*(k-1)/(k-a^2)),rel.tol=.Machine\$double.eps^0.25)
-n*integrate(g,lower=0,upper=sqrt(a^2*k/(k+1-a^2)),rel.tol=.Machine\$double.eps^0.25)
}
lower=1.4, upper=2)
print(unlist(out))}

--

View this message in context: http://www.nabble.com/help-me-to-debug-this-part-of-code--tp16763482p16763482.html Sent from the R help mailing list archive at Nabble.com.

R-help_at_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. Received on Fri 18 Apr 2008 - 15:39:31 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 20 Apr 2008 - 22:30:29 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.