diff --git a/src/robustlinearmodel.jl b/src/robustlinearmodel.jl index 9723ec0..a522a48 100644 --- a/src/robustlinearmodel.jl +++ b/src/robustlinearmodel.jl @@ -1090,11 +1090,12 @@ function pirls_Sestimate!( ) # Skip test for convergence continue - else - installbeta!(p, f) - r.σ = sig end + # Update coefficients + installbeta!(p, f) + r.σ = sig + # Test for convergence Δsig = (sigold - sig) verbose && println("Iteration: $i, scale: $sig, Δsig: $(Δsig)") @@ -1205,10 +1206,11 @@ function pirls_τestimate!( ) # Skip test for convergence continue - else - installbeta!(p, f) end + # Update coefficients + installbeta!(p, f) + # Test for convergence Δtau = (tauold - tau) verbose && println("Iteration: $i, scale: $tau, Δsig: $(Δtau)") diff --git a/test/linearfit.jl b/test/linearfit.jl index 1694a07..5d14d3a 100644 --- a/test/linearfit.jl +++ b/test/linearfit.jl @@ -60,7 +60,7 @@ end @testset "Infinite loop: issue #32" begin # Infinite loop: issue #32 - Xs = [0.001481; 0.0017; 0.00133; 0.001853; 0.002086; 0.003189; 0.001161; 0.002441; 0.001133; 0.001308; 0.001; 0.009309; 0.1456; 0.3127; 0.2627; 0.1704; 0.101; 0.06855; 0.02578] + Xs = reshape([0.001481, 0.0017, 0.00133, 0.001853, 0.002086, 0.003189, 0.001161, 0.002441, 0.001133, 0.001308, 0.001, 0.009309, 0.1456, 0.3127, 0.2627, 0.1704, 0.101, 0.06855, 0.02578], :, 1) ys = [1.222, 1.599, 2.238, 2.233, 2.668, 2.637, 3.177, 2.539, 2.339, 1.481, 1.733, 0.04986, 0.0812, 0.1057, 0.1197, 0.1348, 0.1006, 0.1021, 0.08278] @test_throws Exception rlm(Xs, ys, SEstimator{TukeyLoss}(), initial_scale=:mad) end