Hello,

 

I am trying to do a spearman correlation. My data has tied values. To
overcome this issue, I am adding some random noise (values) to my original
data. However when I add the random noise to the data, the final matrix does
not show the new values. I guess the reason being that the noise I add is
very small and the full value including the decimals gets truncated to show
only the value upto two decimal points. Is there a way to keep the full value
as it is without truncation. Thanks for your suggestions in advance.

 

My script:

 

rand.val: stores the random numbers

data: stores the actual values 

 

rand.val<-data.frame(a=runif(11,0.000000001,0.00000001),b=runif(11,0.00000000
1,0.00000001),
c=runif(11,0.000000001,0.00000001),d=runif(11,0.000000001,0.00000001),e=runif
(11,0.000000001,0.00000001),f=runif(11,0.000000001,0.00000001),g=runif(11,0.0
00000001,0.00000001),h=runif(11,0.000000001,0.00000001))  

rand.val<- as.matrix(rand.val)

 

>data

      X1015 X1238 X1433 X1520 X1847 X1870 X1928 X2422

1-Mar     2     2     2  2.00  2.00  2.00     2  2.00

2-Mar     2     2     2  2.00  2.00  2.00     2  2.00

5-Mar     2     2     2  2.00  4.28  2.00     2  2.00

6-Mar     2     2     2  2.00  2.00  2.00     2  2.72

8-Mar     2     2     2  2.00  2.00  2.00     2  2.00

9-Mar     2     2     2  2.00  2.00  2.00     2  2.00

1-Sep     2     2     2  2.00  2.00  2.00     2  2.00

2-Sep     2     2     2  2.00  2.00  1.39     2  2.00

6-Sep     2     2     2  2.00  2.00  2.00     2  2.00

8-Sep     2     2     2  1.05  2.00  2.00     2  2.00

9-Sep     2     2     2  2.00  2.00  2.00     2  2.00

 

>rand.val

                 a            b            c            d            e
f            g            h

 [1,] 6.066415e-09 7.243185e-09 2.579000e-09 6.140522e-09 6.630778e-09
7.035269e-09 4.122901e-09 1.449599e-09

 [2,] 3.623560e-09 9.038553e-09 2.269913e-09 7.762269e-09 5.540944e-09
1.478679e-09 6.159272e-09 7.082123e-09

 [3,] 2.085766e-09 3.737900e-09 2.457034e-09 4.939643e-09 3.868569e-09
5.015730e-09 3.320189e-09 3.858882e-09

 [4,] 5.037955e-09 8.234747e-09 5.407211e-09 4.136906e-09 9.078506e-09
8.743044e-09 8.026434e-09 7.089469e-09

 [5,] 6.254242e-09 7.805144e-09 5.264731e-09 3.993522e-09 4.668103e-09
9.429713e-09 2.144503e-09 4.739684e-09

 [6,] 2.051520e-09 3.173583e-09 7.463606e-09 2.799975e-09 6.192137e-09
4.345219e-09 1.301613e-09 2.913670e-09

 [7,] 7.278996e-09 4.329527e-09 2.407270e-09 8.421633e-09 4.196166e-09
9.890987e-09 3.783615e-09 4.093923e-09

 [8,] 9.046755e-09 5.665165e-09 7.740206e-09 3.482159e-09 6.048917e-09
3.170118e-09 6.764364e-09 5.860817e-09

 [9,] 7.766820e-09 5.901440e-09 2.198517e-09 7.349194e-09 6.563453e-09
9.981425e-09 7.768106e-09 4.213753e-09

[10,] 4.493040e-09 5.796008e-09 1.623817e-09 8.136924e-09 1.029656e-09
3.725094e-09 8.767293e-09 7.532047e-09

[11,] 5.974140e-09 4.173989e-09 8.704932e-09 1.929161e-09 5.718819e-09
4.995755e-09 4.723989e-09 9.198158e-09

 

>data+rand.val

 

X1015 X1238 X1433 X1520 X1847 X1870 X1928 X2422

1-Mar     2     2     2  2.00  2.00  2.00     2  2.00

2-Mar     2     2     2  2.00  2.00  2.00     2  2.00

5-Mar     2     2     2  2.00  4.28  2.00     2  2.00

6-Mar     2     2     2  2.00  2.00  2.00     2  2.72

8-Mar     2     2     2  2.00  2.00  2.00     2  2.00

9-Mar     2     2     2  2.00  2.00  2.00     2  2.00

1-Sep     2     2     2  2.00  2.00  2.00     2  2.00

2-Sep     2     2     2  2.00  2.00  1.39     2  2.00

6-Sep     2     2     2  2.00  2.00  2.00     2  2.00

8-Sep     2     2     2  1.05  2.00  2.00     2  2.00

9-Sep     2     2     2  2.00  2.00  2.00     2  2.00

 

Manisha

 

 

 


        [[alternative HTML version deleted]]

______________________________________________
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