Open utterances-bot opened 3 years ago
for julia (at least in 1.6) the convert
does not work anymore, so instead of:
versicolor = convert(Matrix, iris[iris.Species .== "versicolor", 1:2])
virginica = convert(Matrix, iris[iris.Species .== "virginica", 1:2])
use
versicolor = Matrix(iris[iris.Species .== "versicolor", 1:2])
virginica = Matrix(iris[iris.Species .== "virginica", 1:2])
Matrix operations aren’t quite as native to Python, so we lack an operator for performing it and have to use np.matmul() twice as a result.
That is not true since 2015 with python 3.5: What is new in Python 5.5
Also the transpose can be used as .T
instead of .transpose()
. With this the above code becomes:
t_squared = (nx*ny)/(nx+ny) * delta.T @, np.linalg.inv(S_pooled)) @ delta
On the other hand both Python and R support unicode for variable names, just like Julia. So in both cases you could have used δ
instead of delta
.
Hotelling's T^2 in Julia, Python, and R - Data & The World
https://data-and-the-world.onrender.com/posts/hotelling-t2-multilanguage/