[R] environments again 2

R. Heberto Ghezzo heberto at meakins.lan.mcgill.ca
Tue Dec 18 16:29:09 CET 2001


Hello,
First thanks to T.Lumley for his prompt and detailed response to
my previous problem with aov, since he send a copy to r-help
I will not repeat it here. Suffice to say that adding
data=data.frame(x,g,s)
works well and no more problems. Thanks Thomas.
Now
here there is another problem with my program to compute
multiple comparisons. From App.Stat I have a fortran program to compute
the probability for Dunnett tests. I compiled it to a dll and it works
well, no problems there. Now I need the inverse 'qdunnett' and I
decided that an easy way |:-)) was to use nls to find the point.
something similar to:

>  alpha<-0.05
>  df<-10
>  nls.control()
$maxiter
[1] 50

$tol
[1] 1e-05

$minFactor
[1] 0.0009765625

>  b<- nls(d~pt(x,a),start=list(x=1),trace=T)
0.6077036 :  1
0.0009502682 :  -2.384037
5.820193e-05 :  -1.913299
4.509105e-07 :  -1.804280
1.659796e-11 :  -1.812411
2.335228e-20 :  -1.812461
4.814825e-33 :  -1.812461
4.333342e-34 :  -1.812461
......
4.333342e-34 :  -1.812461
Error in nls(d ~ pt(x, a), start = list(x = 1), trace = T) :
        number of iterations exceeded maximum of 5.32952e-306
>
which I naively assume will give me a qt in a round about way, so
it could provide me with the qdunnett that I needed, but although it
converges in 3 iterations it does not exit!
Trying with a simple function:
>  fun<-function(x,a) x*x-a
>  b<- nls(d~fun(x,a),start=list(x=1),trace=T)
81.9025 :  1
0.3527249 :  3.2625
6.863586e-05 :  3.17148
2.910360e-12 :  3.170174
6.503427e-27 :  3.170173
1.141884e-30 :  3.170173
.....
1.141884e-30 :  3.170173
Error in nls(d ~ fun(x, a), start = list(x = 1), trace = T) :
        number of iterations exceeded maximum of 5.32952e-306

same error and no exit.
Using R 1.3.1 on Win98. What am I doing wrong this time? there is
no data= here. Is this a bug in nls?
Thanks for any help


-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list