```
using Statistics
using Distributions
x=[1,2,3,4,5,6,7,8]
y=[8,4,5,5,6,5,6,5]
function TwoSampleT2Test(X,Y)
nx, p = size(X)
ny, _ = size(Y)
δ = mean(X, dims=1) - mean(Y, dims=1)
Sx = cov(X)
Sy = cov(Y)
S_pooled = ((nx-1)*Sx + (ny-1)*Sy)/(nx+ny-2)
t_squared = (nx*ny)/(nx+ny) * δ * inv(S_pooled) * transpose(δ)
statistic = t_squared[1,1] * (nx+ny-p-1)/(p*(nx+ny-2))
F = FDist(p, nx+ny-p-1)
p_value= 1 - pvalue(Kolmogorov(), sqrt(x.n)*x.δ; tail=:right)
println("Test statistic: $(statistic)\nDegrees of freedom: $(p) and $(nx+ny-p-1)\np-value: $(p_value)")
return([statistic, p_value])
end
TwoSampleT2Test(x,y)
```

I get a bounds error, something to do with selecting an invalid value of a tuple. Is there a problem with the function, or is it the array/tuple that I was using as a an example?

I also tried to use Rdatasets, but

```
using Rdatasets
iris = dataset("datasets", "iris")
versicolor = convert(Matrix, iris[iris.Species .== "versicolor", 1:2])
virginica = convert(Matrix, iris[iris.Species .== "virginica", 1:2])
```

gave me a multiple definition error in Pluto.