Re: [R] Dividing by 0

From: John Maindonald <john.maindonald_at_anu.edu.au>
Date: Sun, 27 Jul 2008 10:08:05 +1000

I suspect you should be smoothing the series in a manner that replaces zeros by some usually small larger number before you start. Without more details on what you are trying to do, it is impossible to know what is sensible. You are proposing to leave all smoothing ("rolling"?) till later; why not do some smoothing at the start?

John Maindonald email: john.maindonald_at_anu.edu.au phone : +61 2 (6125)3473 fax : +61 2(6125)5549 Centre for Mathematics & Its Applications, Room 1194, John Dedman Mathematical Sciences Building (Building 27) Australian National University, Canberra ACT 0200.

On 26 Jul 2008, at 8:00 PM, r-help-request_at_r-project.org wrote:

> From: nmarti <nate318i_at_yahoo.com>
> Date: 26 July 2008 1:42:09 AM
> To: r-help_at_r-project.org
> Subject: Re: [R] Dividing by 0
>
>
> I'm well aware these are not errors, I guess I miss-wrote.
> I understand your concern. Thanks for passionately looking out for
> my well
> being, you saved my life.
>
> My variable has about 10,000 elements and sometime for the first 100
> to 500
> elements there is lots of 0's, so I end up with lots of NA/NaN/Inf's.
> However, when I try to use "Rolling" calculations I recieve error
> messages
> because the "Rolling" functions reject the NA/NaN/Inf's. So, I need
> 0's in
> place of the NA/NaN/Inf's so I can run the "Rolling" calculations.
> I can't
> just delete these observations, because it messes up lots of other
> other
> things within these dataframes.
>
> I'm well aware these "Rolling" calculations will be wrong in the
> beginning
> of the dataframe, so I just throw these out. The rolling window is
> only
> about 50 odservations, so out of 10,000, I still end up with ample
> correct
> data and calculations.
>
> So is this still idiotic?
> Thanks again for your concern. Now that you understand my situation a
> little better, you might be less distracted today and be able to sleep
> better tonight.



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 Sun 27 Jul 2008 - 00:12:46 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 27 Jul 2008 - 01:32:31 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.

list of date sections of archive