Skip to content

Commit

Permalink
py95() returns betas
Browse files Browse the repository at this point in the history
  • Loading branch information
jbytecode authored Jan 24, 2023
1 parent 832a2e8 commit f2d5bad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
- Replace GLPK with HiGHS. When n > 10000, HiGHS based lad() is now approximately 6x faster.
- asm2000(), imon2005(), ks89(), bacon(), and smr98() now return regression coefficients calculated using the clean set of observations.
- lts() has a new optional parameter called earlystop and it is true by default. If the objective function does not change in a predefined number of iterations, the search is stopped.
- py95() returns vector of estimated regression coefficients using the clean observations.


# v0.9.2

Expand Down
8 changes: 7 additions & 1 deletion src/py95.jl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ the eigen structure of the influence matrix is examined for detecting suspected
# Output
- `["outliers"]`: Array of indices of outliers
- `["suspected.sets"]`: Arrays of indices of observations for corresponding eigen value of the influence matrix.
- `["betas]`: Vector of estimated regression coefficients using the clean observations.
# Examples
```julia-repl
Expand Down Expand Up @@ -214,9 +214,15 @@ function py95(X::Array{Float64,2}, y::Array{Float64,1})
push!(outlierset, element)
end
end

inlierset = setdiff(1:n, outlierset)
cleanols = ols(X[inlierset, :], y[inlierset])
cleanbetas = coef(cleanols)

result = Dict()
result["suspected.sets"] = suspicious_sets
result["outliers"] = sort(collect(outlierset))
result["betas"] = cleanbetas
return result
end

Expand Down

0 comments on commit f2d5bad

Please sign in to comment.