diff --git a/CHANGELOG.md b/CHANGELOG.md index f3b46f5..4f91308 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # v0.11.4 (Upcoming Release) +- More explicit return types, drop `Dict` with `Dict{String, Any}` or `Dict{String, Vector}` + # v0.11.3 diff --git a/src/asm2000.jl b/src/asm2000.jl index 193999b..f821602 100644 --- a/src/asm2000.jl +++ b/src/asm2000.jl @@ -97,7 +97,7 @@ function asm2000(X::AbstractMatrix{Float64}, y::AbstractVector{Float64})::Dict cleanols = ols(X[inlierset, :], y[inlierset]) cleanbetas = coef(cleanols) - result = Dict() + result = Dict{String, Vector}() result["outliers"] = outlierset result["betas"] = cleanbetas return result diff --git a/src/atkinson94.jl b/src/atkinson94.jl index fc30fe9..a64492c 100644 --- a/src/atkinson94.jl +++ b/src/atkinson94.jl @@ -138,7 +138,7 @@ function atkinson94( end end - d = Dict() + d = Dict{String, Any}() d["coef"] = bestparameters d["objective"] = bestobjective d["optimum_index"] = bestindex diff --git a/src/bacon.jl b/src/bacon.jl index 3390029..04ca35f 100644 --- a/src/bacon.jl +++ b/src/bacon.jl @@ -131,7 +131,7 @@ function bacon_multivariate_outlier_detection( break end end - d = Dict() + d = Dict{String, Any}() d["outliers"] = setdiff(1:n, subset) d["distances"] = distances return d diff --git a/src/ccf.jl b/src/ccf.jl index ddef89f..3e7c9ee 100644 --- a/src/ccf.jl +++ b/src/ccf.jl @@ -139,7 +139,7 @@ function ccf( old_lambdas .= curr_lambdas end - result = Dict() + result = Dict{String, Any}() result["betas"] = curr_betas result["lambdas"] = old_lambdas result["residuals"] = residuals diff --git a/src/gwlts.jl b/src/gwlts.jl index df10744..1e922de 100644 --- a/src/gwlts.jl +++ b/src/gwlts.jl @@ -72,7 +72,7 @@ function galts(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}) ltsreg = ols(X[subsetindices, :], y[subsetindices]) betas = coef(ltsreg) - result = Dict() + result = Dict{String, Any}() result["betas"] = betas result["best.subset"] = sort(subsetindices) result["objective"] = objective diff --git a/src/hadi1992.jl b/src/hadi1992.jl index e450d19..d960b47 100644 --- a/src/hadi1992.jl +++ b/src/hadi1992.jl @@ -145,7 +145,7 @@ function hadi1992(multivariateData::AbstractMatrix{Float64}; alpha = 0.05) outlierset = setdiff(allindices, basic_subset_indices) - result = Dict() + result = Dict{String, Any}() result["outliers"] = sort(outlierset) result["critical.chi.squared"] = critical_quantile result["rth.robust.distance"] = sorted_mah1[r-1] diff --git a/src/hadi1994.jl b/src/hadi1994.jl index 80d6344..46f8edc 100644 --- a/src/hadi1994.jl +++ b/src/hadi1994.jl @@ -123,7 +123,7 @@ function hadi1994(multivariateData::AbstractMatrix{Float64}; alpha = 0.05) outlierset = setdiff(allindices, basic_subset_indices) - result = Dict() + result = Dict{String, Any}() result["outliers"] = sort(outlierset) result["critical.chi.squared"] = critical_quantile result["rth.robust.distance"] = sorted_mah1[r-1] diff --git a/src/imon2005.jl b/src/imon2005.jl index e6cc897..29d3913 100644 --- a/src/imon2005.jl +++ b/src/imon2005.jl @@ -96,7 +96,7 @@ function imon2005(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}) cleanols = ols(X[inlierindex, :], y[inlierindex]) cleanbeta = coef(cleanols) - result::Dict{String,Any} = Dict() + result::Dict{String,Any} = Dict{String, Any}() result["crit"] = crit result["gdffits"] = GDFFITS result["outliers"] = outlyingindex diff --git a/src/lad.jl b/src/lad.jl index 4e056b7..5b077b4 100644 --- a/src/lad.jl +++ b/src/lad.jl @@ -124,7 +124,7 @@ function lad_exact(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}) betahats = JuMP.value.(beta) residuals = y .- X * betahats - result = Dict() + result = Dict{String, Any}() result["betas"] = betahats result["residuals"] = residuals result["model"] = m diff --git a/src/lms.jl b/src/lms.jl index 9edaf0f..a46c2e7 100644 --- a/src/lms.jl +++ b/src/lms.jl @@ -91,7 +91,7 @@ function lms(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}; iters = not end s = 1.4826 * sqrt((1.0 + (5.0 / (n - p))) * bestobjective) standardizedres = bestres / s - d = Dict() + d = Dict{String, Any}() d["betas"] = bestparamaters d["objective"] = bestobjective d["S"] = s diff --git a/src/mve.jl b/src/mve.jl index 7117ac0..6eac500 100644 --- a/src/mve.jl +++ b/src/mve.jl @@ -80,7 +80,7 @@ function robcov(data::DataFrame; alpha = 0.01, estimator = :mve) ), ) outlierset = filter(x -> md2[x] > chisqcrit, 1:n) - result = Dict() + result = Dict{String, Any}() result["goal"] = mingoal result["best.subset"] = sort(besthsubset) result["robust.location"] = meanvector diff --git a/src/mveltsplot.jl b/src/mveltsplot.jl index bb3f739..27bac09 100644 --- a/src/mveltsplot.jl +++ b/src/mveltsplot.jl @@ -85,7 +85,7 @@ function mveltsplot(setting::RegressionSetting; alpha = 0.05, showplot = true) vline!([chicrit]) end - result = Dict() + result = Dict{String, Any}() result["plot"] = scplot result["robust.distances"] = robdistances result["scaled.residuals"] = scaledresiduals diff --git a/src/py95.jl b/src/py95.jl index 326ed4b..fc3abd6 100644 --- a/src/py95.jl +++ b/src/py95.jl @@ -219,7 +219,7 @@ function py95(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}) cleanols = ols(X[inlierset, :], y[inlierset]) cleanbetas = coef(cleanols) - result = Dict() + result = Dict{String, Any}() result["suspected.sets"] = suspicious_sets result["outliers"] = sort(collect(outlierset)) result["betas"] = cleanbetas diff --git a/src/quantileregression.jl b/src/quantileregression.jl index c54c0c0..c7a4660 100644 --- a/src/quantileregression.jl +++ b/src/quantileregression.jl @@ -96,7 +96,7 @@ function quantileregression(X::AbstractMatrix{Float64}, y::AbstractVector{Float6 ) for i = 1:n - c = JuMP.@constraint(m, y[i] - sum(X[i, :] .* beta) + d[i] - d[n+i] == 0) + _ = JuMP.@constraint(m, y[i] - sum(X[i, :] .* beta) + d[i] - d[n+i] == 0) end for i = 1:(2n) @@ -108,7 +108,7 @@ function quantileregression(X::AbstractMatrix{Float64}, y::AbstractVector{Float6 betahats = JuMP.value.(beta) residuals = y .- X * betahats - result = Dict() + result = Dict{String, Any}() result["betas"] = betahats result["residuals"] = residuals result["model"] = m diff --git a/src/satman2013.jl b/src/satman2013.jl index 7bd30fc..3a65dbc 100644 --- a/src/satman2013.jl +++ b/src/satman2013.jl @@ -113,7 +113,7 @@ function satman2013(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}) outlierset = filter(i -> abs(standardized_resids[i]) > 2.5, allindices) - result = Dict() + result = Dict{String, Any}() result["outliers"] = outlierset result["betas"] = betas result["residuals"] = resids diff --git a/src/satman2015.jl b/src/satman2015.jl index 150aadd..5e04502 100644 --- a/src/satman2015.jl +++ b/src/satman2015.jl @@ -290,7 +290,7 @@ function satman2015(X::AbstractMatrix{Float64}, y::AbstractVector{Float64}) outlierset = filter(i -> abs(standardized_resids[i]) > 2.5, allindices) - result = Dict() + result = Dict{String, Any}() result["outliers"] = outlierset result["betas"] = betas