[R] When to set small values to 0?

Ravi Varadhan rvaradhan at jhmi.edu
Fri Oct 3 15:28:02 CEST 2008

It really dependes on the nature of the computations that you are doing to obtain these real vectors, and also on the objective of your problem.  For example, if the real vectors are the result of some numerical approximation, then you can set the threshold to be equal to the error involved in the approaximation, if you know that.  If these thresholds are too high to be appropriate for your objective, then you can increase the accuracy of your numerical approximation and obtain a smaller threshold.


Ravi Varadhan, Ph.D.
Assistant Professor,
Division of Geriatric Medicine and Gerontology
School of Medicine
Johns Hopkins University

Ph. (410) 502-2619
email: rvaradhan at jhmi.edu

----- Original Message -----
From: Hesen Peng <hesen.peng at gmail.com>
Date: Thursday, October 2, 2008 9:55 pm
Subject: [R] When to set small values to 0?
To: R help forum <r-help at r-project.org>

> My dear R buddies,
>  I've run into a problem when doing numerical computation recently. In
>  a program that I've been working on, I usually get a vector of real
>  values which are theoretically (and it's correct) supposed to decrease
>  until reaching zero after a given value. However, most of the value
>  just wander at 10^-8 scale and never shrink exactly to zero. So I
>  guess I should manually add a threshold to set the values to zero. But
>  does anyone know any choice of these thresholds? Thanks very much.
>  -- 
>  彭河森 Hesen Peng
>  ______________________________________________
>  R-help at r-project.org mailing list
>  PLEASE do read the posting guide 
>  and provide commented, minimal, self-contained, reproducible code.

More information about the R-help mailing list