[R] Error in optim while using fitdistr() function

Jason Q. McClintic jqmcclintic at stthomas.edu
Sun Feb 10 16:15:15 CET 2008


I get the digest, so I apologize if this is a little late.

For your situation (based on the description and what I think your code 
is doing, more on that below), it looks like you are modeling a Poisson 
flow where the number of hits per unit time is a random integer with 
some mean value.

If I understand your code correctly, you are trying to put your data 
into k bins of width f<-(max(V1)-min(V1))/k. In that case I would think
something like this would work more efficiently:

m<-min(V1);
k<-floor(1 + log2(length(V1)));
f<-(max(V1)-min(V1))/k;
binCount<-NULL;
for(i in seq(length=k)){
  binIndex<-which((m+(i-1)*f<V1)&(V1<m+i*f));
  binCount[i]<-sum(V2[binIndex]);
};

where i becomes the index of time intervals.

Hope it helps.

Sincerely,

Jason Q. McClintic

r-help-request at r-project.org wrote:
> Send R-help mailing list submissions to
> 	r-help at r-project.org
> 
> To subscribe or unsubscribe via the World Wide Web, visit
> 	https://stat.ethz.ch/mailman/listinfo/r-help
> or, via email, send a message with subject or body 'help' to
> 	r-help-request at r-project.org
> 
> You can reach the person managing the list at
> 	r-help-owner at r-project.org
> 
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of R-help digest..."
>



More information about the R-help mailing list