Erik Iverson wrote:
> Just a general comment, I have not looked at your code.  You may want
> to look at the Debugging R portion of the Introduction to R manual on
> CRAN.  There is also a graphical debugger from the 'debug' package on
> CRAN. Either one of these will become immensely helpful in situations
> like this.
>
Also, in this particular case, the offending call is in your own code,
so how about print()ing the arguments to runif() before running it?

> Yasin Hajizadeh wrote:
>>   Hi all
>>   I would be grateful you can help me with my problem.
>>   I try to run an optimization code . in one line I have runif in
>> order to sample the PDF. I get this error while i run it.      Error
>> in runif(1, f$d[[n.of.u.vars + n.of.o.vars + j]][[2]][1],
>> f$d[[n.of.u.vars +  :   invalid arguments
>>
I.e, insert

print(f$d[[n.of.u.vars+n.of.o.vars+j]][[2]][1:2])

at the beginning of the for loop below

>>     for (j in 1:n.of.x.vars) {
>>       X <- c(X, runif(1,f$d[[n.of.u.vars+n.of.o.vars+j]][[2]][1],
>>         f$d[[n.of.u.vars+n.of.o.vars+j]][[2]][2]))
>>     }
>>     X <- t(X)
(You likely don't really want to grow X on every call to runif(), but
that is a different matter)

-- 
   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark      Ph:  (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])              FAX: (+45) 35327907

______________________________________________
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.

Reply via email to