Skip to content

Conversation

@kassambara
Copy link
Owner

Summary

  • Fix x-axis scaling issue in ggcoxdiagnostics() when using ox.scale = "time" with Schoenfeld residuals
  • Extract time values from residuals attributes instead of using rownames
  • Handle both univariate and multivariate Cox models correctly

Changes

  • R/ggcoxdiagnostics.R: Replace incorrect time extraction with proper method using residuals attributes
  • tests/testthat/test-ggcoxdiagnostics.R: Add comprehensive tests for time axis scaling
  • NEWS.md: Document the bug fix

Test plan

  • Verify x-axis shows correct event times instead of observation indices
  • Test with both univariate and multivariate Cox models
  • Test with both "schoenfeld" and "scaledsch" residual types
  • Ensure all existing tests continue to pass

Fixes #608

- Extract time values from residuals attributes instead of rownames
- Handle both univariate and multivariate Cox models correctly
- Add comprehensive tests for time axis scaling
@kassambara kassambara merged commit 3e7b59d into master Sep 2, 2025
5 checks passed
@kassambara kassambara deleted the fix-608-ggcoxdiag branch September 2, 2025 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

possible issue with xaxis of ggcoxdiagnostics

2 participants