Skip to content

Commit 906269f

Browse files
committed
Use size(x, 1) and size(x, 2) instead of n, _ = size(x) and _, p = size(x), respectively
1 parent 63192e9 commit 906269f

File tree

10 files changed

+18
-16
lines changed

10 files changed

+18
-16
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# v0.11.7 (Upcoming Release)
22

3+
- Use `size(x, 1)` and `size(x, 2)` instead of `n, _ = size(x)` and `_, p = size(x)`, respectively.
4+
35

46
# v0.11.6
57

src/bacon.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function initial_basic_subset_multivariate_data(
2828
m::Int;
2929
method::String = "mahalanobis",
3030
)
31-
n, _ = size(X)
31+
n = size(X, 1)
3232
if method == "mahalanobis"
3333
msm = mahalanobisSquaredMatrix(X)
3434

src/dataimage.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function dataimage(
6969

7070
end
7171
colours = 1.0 .- d / maximum(d)
72-
n, _ = size(d)
72+
n = size(d, 1)
7373
colormatrix = Array{RGBX{Float64},2}(undef, n, n)
7474
for i = 1:n
7575
for j = 1:n

src/diagnostics.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Marchette, David J., and Jeffrey L. Solka. "Using data images for outlier detect
4343
Computational Statistics & Data Analysis 43.4 (2003): 541-552.
4444
"""
4545
function euclideanDistances(dataMatrix::AbstractMatrix{Float64})::AbstractMatrix{Float64}
46-
n, _ = size(dataMatrix)
46+
n = size(dataMatrix, 1)
4747
d = zeros(Float64, n, n)
4848
for i 1:n
4949
for j i:n
@@ -59,7 +59,7 @@ end
5959

6060

6161
function mahalanobisSquaredBetweenPairs(pairs::AbstractMatrix{Float64}; covmatrix = nothing)::Union{Nothing, AbstractMatrix}
62-
n, _ = size(pairs)
62+
n = size(pairs, 1)
6363
newmat = zeros(Float64, n, n)
6464
if isnothing(covmatrix)
6565
covmatrix = cov(pairs)
@@ -103,7 +103,7 @@ Computational Statistics & Data Analysis 43.4 (2003): 541-552.
103103
"""
104104
function mahalanobisBetweenPairs(dataMatrix::AbstractMatrix{Float64})::Union{Nothing, Matrix}
105105

106-
n, _ = size(dataMatrix)
106+
n = size(dataMatrix, 1)
107107

108108
d = zeros(Float64, n, n)
109109

@@ -153,7 +153,7 @@ julia> coordinatwisemedians(mat)
153153
```
154154
"""
155155
function coordinatwisemedians(datamat::AbstractMatrix{Float64})::AbstractVector{Float64}
156-
_, p = size(datamat)
156+
p = size(datamat, 2)
157157
meds = map(i -> median(datamat[:, i]), 1:p)
158158
return meds
159159
end
@@ -200,7 +200,7 @@ function dffit(setting::RegressionSetting, i::Int)::Float64
200200
end
201201

202202
function dffit(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}, i::Int)::Float64
203-
n, _ = size(X)
203+
n = size(X, 1)
204204
indices = [j for j 1:n if i != j]
205205
olsfull = ols(X, y)
206206
Xsub = X[indices, :]
@@ -256,13 +256,13 @@ Belsley, David A., Edwin Kuh, and Roy E. Welsch. Regression diagnostics:
256256
Identifying influential data and sources of collinearity. Vol. 571. John Wiley & Sons, 2005.
257257
"""
258258
function dffits(setting::RegressionSetting)::AbstractVector{Float64}
259-
n, _ = size(setting.data)
259+
n = size(setting.data, 1)
260260
result = [dffit(setting, i) for i 1:n]
261261
return result
262262
end
263263

264264
function dffits(X::AbstractMatrix{Float64}, y::AbstractVector{Float64})::AbstractVector{Float64}
265-
n, _ = size(X)
265+
n = size(X, 1)
266266
result = [dffit(X, y, i) for i 1:n]
267267
return result
268268
end
@@ -398,7 +398,7 @@ end
398398

399399
function adjustedResiduals(X::AbstractMatrix{Float64}, y::AbstractVector{Float64})::AbstractVector{Float64}
400400
olsreg = ols(X, y)
401-
n, _ = size(X)
401+
n = size(X, 1)
402402
e = residuals(olsreg)
403403
hat = hatmatrix(X)
404404
stde = [e[i] / (sqrt(1 - hat[i, i])) for i 1:n]

src/hadi1992.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Hadi, Ali S. "Identifying multiple outliers in multivariate data."
2929
Journal of the Royal Statistical Society: Series B (Methodological) 54.3 (1992): 761-771.
3030
"""
3131
function hadi1992_handle_singularity(S::AbstractMatrix{Float64})::AbstractMatrix{Float64}
32-
p, _ = size(S)
32+
p = size(S, 2)
3333
eigen_structure = eigen(S)
3434
values = eigen_structure.values
3535
vectors = eigen_structure.vectors

src/hs93.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ function hs93initialset(setting::RegressionSetting)::Array{Int,1}
4545
end
4646

4747
function hs93initialset(X::AbstractMatrix{Float64}, y::AbstractVector{Float64})::Array{Int,1}
48-
_, p = size(X)
48+
p = size(X, 2)
4949
s = p + 1
5050
dfs = abs.(dffits(X, y))
5151
sortedindices = sortperm(dfs)

src/lts.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function iterateCSteps(
8080
initialBetas::AbstractVector{Float64},
8181
h::Int; eps::Float64 = 0.01, maxiter::Int = 10000
8282
)
83-
_, p = size(X)
83+
p = size(X, 2)
8484
res = y - X * initialBetas
8585
sortedresindices = sortperm(abs.(res))
8686
subsetindices = sortedresindices[1:p]

src/py95.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ end
198198

199199

200200
function py95(X::AbstractMatrix{Float64}, y::AbstractVector{Float64})
201-
n, _ = size(X)
201+
n = size(X, 1)
202202
all_indices = collect(1:n)
203203
suspicious_sets = py95SuspectedObservations(X, y)
204204
outlierset = Set{Int}()

src/satman2015.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ Deb, Kalyanmoy, et al. "A fast elitist non-dominated sorting genetic algorithm f
150150
International conference on parallel problem solving from nature. Springer, Berlin, Heidelberg, 2000.
151151
"""
152152
function ndsranks(data::AbstractMatrix)::Array{Int}
153-
n, _ = size(data)
153+
n = size(data, 1)
154154
ranks = zeros(Int, n)
155155
mat = convert(Matrix, data)
156156
for i = 1:n

src/summary.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ function detectOutliers(X::AbstractMatrix{Float64}, y::AbstractVector{Float64};
106106
end
107107
elseif method == "bacon"
108108
try
109-
_, p = size(X)
109+
p = size(X, 2)
110110
result = bacon(X, y, m = p + 1)["outliers"]
111111
catch
112112
result = Int[]

0 commit comments

Comments
 (0)