Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Logistic Regression with Restricted Cubic Spline and subsequent survival analysis graph

    Hi

    I am struggling with creating a survival graph after a logistic regression using the odds ratio. This is the sample of data I am working with:

    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input byte diseasetype int(PI DI) byte Event
    3  11  45 1
    1  70  55 0
    1  23  43 0
    6  90  45 1
    3  21  29 0
    1  70  32 0
    1  70  33 0
    6 100  33 1
    4  16  22 1
    3  45  32 1
    1  45   6 1
    3  11  21 1
    6 120   7 1
    4 800 295 1
    6 130  55 0
    3  45  44 0
    3  15  45 0
    5 100  36 1
    5 140  48 0
    5 580 148 1
    5 100  47 1
    3 321  34 0
    1  15  25 0
    5 456 101 1
    6 150  56 1
    3  50  49 0
    6  23  18 0
    5   6  78 0
    3  45  45 1
    5  18  23 0
    6  44  55 1
    5  12  21 0
    4  55  67 1
    7  70  66 1
    1  70  34 0
    6  90  33 0
    6  66  64 1
    1 123  56 1
    3 100  39 1
    5  21  21 1
    1 140  55 1
    4 234  24 1
    5 145  44 1
    6  21  26 0
    7 400  55 1
    1 140  59 1
    3  90  42 1
    3  45  28 1
    3  17  88 1
    5  22  58 1
    5 120  99 1
    3 150  47 1
    2  44  48 1
    6 556  78 1
    4  12  24 0
    4  21  21 0
    3  50  53 1
    5 234  34 1
    5 150  49 1
    2  45  56 1
    3 120  11 1
    6 100  77 1
    7 120  81 0
    1 334  89 1
    6  90  49 1
    7  60   9 0
    2 234  61 1
    7 130  23 1
    7  21  26 0
    3 456  45 1
    5 290   6 1
    4  22  24 0
    6  45  17 1
    1 280  89 1
    6  67  30 1
    6  60  48 0
    1   8  21 1
    6 150   7 1
    3  30  11 1
    2   9  46 1
    5  70  34 1
    5   7  20 0
    6  88  29 0
    1 190  70 1
    2  99 115 1
    7 140  49 1
    3 999  30 1
    3  12  68 1
    5 234  54 1
    1 567  28 0
    3  50  52 1
    7 876  28 0
    2  70  29 1
    . 543   . .
    .   .   . .
    . 456   . .
    .   .   . .
    .  54   . .
    end

    Here event is the dependent variable and PI and DI are the explanatory variable. First I need to do a logistic regression using restricted cubic splines on PI and DI separately (mkspline command). Once done I would like to generate a graph like the one attached. It would be great if someone can help me with the process:

    Click image for larger version

Name:	Screenshot 2023-12-03 204548.png
Views:	2
Size:	185.4 KB
ID:	1735936


    Attached Files
Working...
X