How to add decimals to correlation coefficients in DescTools?

66 Views Asked by At

I'm trying the DescTools package with the standard d.pizza datafile. When I try to do a bivariate analysis on the data it gives 0's for the correlation coefficients and I don't know how to change that.

Desc(price ~ delivery_min, d.pizza)

price ~ delivery_min (d.pizza)

Summary: 
n pairs: 1,209.0000, valid: 1,197.0000 (99.0%), missings: 12.0000 (1.0%)

Pearson corr. : 0
Spearman corr.: 0
Kendall corr. : 0
1

There are 1 best solutions below

5
dipetkov On

You elaborate further in a comment that all correlations are reported as 1, 0 or -1.

Since the correlation coefficient varies between -1 and 1, the evidence strongly suggests that you get rounded numbers: correlations between -1 and -0.5 are shows as -1; correlations between -0.5 and 0.5 are shown as 0; and correlations between 0.5 and 1 as 1. Surely this is not what you intend.

Why the output is rounded is not clear (have you changed any default settings?) and the issue is not reproducible. Here is what I get when I repeat your steps:

library("DescTools")

Desc(price ~ delivery_min, d.pizza)
#> ------------------------------------------------------------------------------ 
#> price ~ delivery_min (d.pizza)
#> 
#> Summary: 
#> n pairs: 1'209, valid: 1'197 (99.0%), missings: 12 (1.0%)
#> 
#> 
#> Pearson corr. : 0.095
#> Spearman corr.: 0.080
#> Kendall corr. : 0.054

Created on 2022-07-27 by the reprex package (v2.0.1)