How to menage decimals in order to obtain accurate estimates
On 02/06/2013 07:51 PM, mary wrote:
I'm sorry, I have a data set contains numbers with more decimal places, the data are available in R "data (milk)". I made a loop to get a robust correlation matrix but in calculations, decimals cause me problems ( especially I do not know how R rounds numbers by default) so the diagonal should be equal to one is not. I hope it's clearer.
Hi mary, That's okay, nearly everybody thinks that because they know what they are talking about, everyone else does, too. I don't know which dataset you are using as there seem to be several "milk" datasets. However, unless you are doing a lot of sequential calculations, it is probably not the machine precision that is causing your errors, as they would be much smaller. What may be happening is that you are treating robust estimates as exact parametric estimates, thus generating larger errors in your calculations. The simplest way to check this is to run a small example calculation and print out the successive results that you get. You may see one result that is clearly wrong and can work out where the error is being made. Jim