Re: [R] computing standard deviation in R and in Python

2019-05-24 Thread Bogdan Tanasa
Dear Rui, thank you very much ! On Fri, May 24, 2019 at 4:35 AM Rui Barradas wrote: > Hello, > > This has to do with what kind of variance estimator is being used. > R uses the unbiased estimator and Python the MLE one. > > > > var1 <- function(x){ >n <- length(x) >(sum(x^2) - sum(x)^2/n

Re: [R] computing standard deviation in R and in Python

2019-05-24 Thread Rui Barradas
Hello, This has to do with what kind of variance estimator is being used. R uses the unbiased estimator and Python the MLE one. var1 <- function(x){ n <- length(x) (sum(x^2) - sum(x)^2/n)/(n - 1) } var2 <- function(x){ n <- length(x) (sum(x^2) - sum(x)^2/n)/n } sd1 <- function(x) sqrt

[R] computing standard deviation in R and in Python

2019-05-24 Thread Bogdan Tanasa
Dear all, please would you advise : do python and R have different ways to compute the standard deviation (sd) ? for example, in python, starting with : a = np.array([[1,2,3], [4,5,6], [7,8,9]]) print(a.std(axis=1)) ### per row : [0.81649658 0.81649658 0.81649658] print(a.std(axis=0)) ### per c