Skip to content

Commit

Permalink
Add a test to increase coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
ararslan committed Dec 17, 2017
1 parent 3cbcaf0 commit e56a87e
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,22 @@ end
outcome = coxph(@formula(event ~ fin+age+race+wexp+mar+paro+prio), rossi; tol = 1e-8)
outcome_coefmat = coeftable(outcome)

@test sprint(show, outcome) == """
StatsModels.DataFrameRegressionModel{Survival.CoxModel{Float64},Array{Float64,2}}
Formula: event ~ fin + age + race + wexp + mar + paro + prio
Coefficients:
Estimate Std.Error z value Pr(>|z|)
fin -0.379422 0.191379 -1.98256 0.0474
age -0.0574377 0.0219995 -2.61087 0.0090
race 0.3139 0.307993 1.01918 0.3081
wexp -0.149796 0.212224 -0.705837 0.4803
mar -0.433704 0.381868 -1.13574 0.2561
paro -0.0848711 0.195757 -0.433554 0.6646
prio 0.0914971 0.0286485 3.19378 0.0014
"""

coef_matrix = ModelMatrix(ModelFrame(@formula(event ~ 0+fin+age+race+wexp+mar+paro+prio), rossi)).m
outcome_from_matrix = coxph(coef_matrix, rossi[:event]; tol = 1e-8, l2_cost = 0)
outcome_from_matrix32 = coxph(Float32.(coef_matrix), rossi[:event]; tol = 1e-5)
Expand Down Expand Up @@ -220,4 +236,4 @@ end
end
@test_throws ErrorException Survival.newton_raphson(wrong_fgh!, [2.2])

end
end

0 comments on commit e56a87e

Please sign in to comment.