I am conducting a restrited cubic spline for the association between vigorous physical activity and specific mortality, but the predicted estimated values and the plotted spline do not match since there is a part of the spline with the upper bound lower than 1, which do not happen with the predicted value. I am using the Orsini procedure.
These are the values I am getting with the xbrcspline command and below the plot for the spline.
VPA_min exp(XB) LB UB
0 1.28 1.06 1.55
10 1.26 1.06 1.50
11 1.25 1.06 1.49
12 1.25 1.06 1.49
13 1.25 1.05 1.48
14 1.25 1.05 1.47
15 1.24 1.05 1.47
16 1.24 1.05 1.46
17 1.24 1.05 1.46
18 1.24 1.05 1.45
19 1.23 1.05 1.45
20 1.23 1.05 1.44
22 1.23 1.05 1.43
23 1.22 1.05 1.43
24 1.22 1.05 1.42
25 1.22 1.05 1.41
26 1.22 1.05 1.41
27 1.21 1.05 1.40
28 1.21 1.05 1.40
29 1.21 1.05 1.39
30 1.21 1.05 1.39
32 1.20 1.05 1.38
33 1.20 1.04 1.37
34 1.20 1.04 1.37
35 1.19 1.04 1.36
36 1.19 1.04 1.36
37 1.19 1.04 1.35
38 1.19 1.04 1.35
39 1.18 1.04 1.34
40 1.18 1.04 1.34
42 1.18 1.04 1.33
44 1.17 1.04 1.32
45 1.17 1.04 1.32
46 1.17 1.04 1.31
48 1.16 1.04 1.30
49 1.16 1.04 1.30
50 1.16 1.04 1.29
51 1.16 1.04 1.29
52 1.15 1.04 1.28
53 1.15 1.04 1.28
54 1.15 1.03 1.27
55 1.15 1.03 1.27
56 1.14 1.03 1.27
57 1.14 1.03 1.26
58 1.14 1.03 1.26
60 1.14 1.03 1.25
64 1.13 1.03 1.23
65 1.12 1.03 1.23
66 1.12 1.03 1.22
68 1.12 1.03 1.22
69 1.12 1.03 1.21
70 1.11 1.03 1.21
72 1.11 1.03 1.20
74 1.11 1.03 1.19
75 1.10 1.03 1.19
76 1.10 1.02 1.18
77 1.10 1.02 1.18
78 1.10 1.02 1.18
80 1.09 1.02 1.17
81 1.09 1.02 1.17
82 1.09 1.02 1.16
84 1.09 1.02 1.16
85 1.08 1.02 1.15
87 1.08 1.02 1.15
88 1.08 1.02 1.14
90 1.08 1.02 1.14
91 1.07 1.02 1.13
92 1.07 1.02 1.13
93 1.07 1.02 1.13
96 1.07 1.02 1.12
98 1.06 1.02 1.11
99 1.06 1.01 1.11
100 1.06 1.01 1.10
102 1.06 1.01 1.10
104 1.05 1.01 1.09
105 1.05 1.01 1.09
106 1.05 1.01 1.09
108 1.05 1.01 1.08
110 1.04 1.01 1.08
111 1.04 1.01 1.07
112 1.04 1.01 1.07
114 1.04 1.01 1.07
117 1.03 1.01 1.06
119 1.03 1.01 1.06
120 1.03 1.01 1.05
121 1.03 1.01 1.05
124 1.02 1.01 1.04
125 1.02 1.01 1.04
126 1.02 1.01 1.04
128 1.02 1.00 1.04
129 1.02 1.00 1.03
130 1.02 1.00 1.03
132 1.02 1.00 1.03
133 1.01 1.00 1.03
135 1.01 1.00 1.02
136 1.01 1.00 1.02
138 1.01 1.00 1.02
140 1.01 1.00 1.01
141 1.01 1.00 1.01
144 1.00 1.00 1.01
145 1.00 1.00 1.01
147 1.00 1.00 1.00
148 1.00 1.00 1.00
150 1.00 1.00 1.00
152 1.00 1.00 1.00
154 1.00 0.99 1.00
156 1.00 0.99 1.00
159 0.99 0.99 1.00
160 0.99 0.99 1.00
161 0.99 0.99 1.00
162 0.99 0.99 1.00
165 0.99 0.98 1.00
168 0.99 0.98 1.00
170 0.99 0.98 1.00
171 0.99 0.98 1.00
172 0.99 0.98 1.00
174 0.99 0.97 1.00
175 0.99 0.97 1.00
176 0.99 0.97 1.00
177 0.99 0.97 1.00
180 0.99 0.97 1.00
182 0.99 0.97 1.01
184 0.99 0.97 1.01
185 0.99 0.97 1.01
188 0.99 0.96 1.01
189 0.99 0.96 1.01
190 0.99 0.96 1.01
192 0.99 0.96 1.01
195 0.99 0.96 1.01
196 0.99 0.96 1.01
198 0.99 0.96 1.02
200 0.99 0.96 1.02
203 0.99 0.95 1.02
204 0.99 0.95 1.02
207 0.99 0.95 1.02
208 0.99 0.95 1.03
210 0.99 0.95 1.03
212 0.99 0.95 1.03
216 0.99 0.95 1.03
217 0.99 0.95 1.04
220 0.99 0.94 1.04
222 0.99 0.94 1.04
224 0.99 0.94 1.04
225 0.99 0.94 1.05
228 0.99 0.94 1.05
230 0.99 0.94 1.05
231 0.99 0.94 1.05
234 1.00 0.94 1.06
235 1.00 0.94 1.06
238 1.00 0.93 1.06
240 1.00 0.93 1.07
244 1.00 0.93 1.07
245 1.00 0.93 1.07
250 1.00 0.93 1.08
252 1.00 0.93 1.09
255 1.00 0.92 1.09
259 1.01 0.92 1.10
260 1.01 0.92 1.10
264 1.01 0.92 1.11
265 1.01 0.92 1.11
266 1.01 0.92 1.11
268 1.01 0.92 1.11
270 1.01 0.92 1.12
273 1.01 0.91 1.12
275 1.01 0.91 1.13
280 1.02 0.91 1.14
285 1.02 0.91 1.14
288 1.02 0.91 1.15
290 1.02 0.91 1.15
300 1.03 0.90 1.17
308 1.03 0.90 1.19
315 1.03 0.89 1.20
318 1.04 0.89 1.21
320 1.04 0.89 1.21
322 1.04 0.89 1.22
325 1.04 0.89 1.22
329 1.04 0.88 1.23
330 1.04 0.88 1.23
336 1.05 0.88 1.24
340 1.05 0.88 1.25
345 1.05 0.87 1.26
350 1.05 0.87 1.27
356 1.06 0.87 1.28
357 1.06 0.87 1.29
360 1.06 0.87 1.29
364 1.06 0.86 1.30
371 1.06 0.86 1.32
375 1.07 0.86 1.32
378 1.07 0.86 1.33
380 1.07 0.86 1.34
385 1.07 0.85 1.35
390 1.07 0.85 1.36
392 1.08 0.85 1.36
399 1.08 0.85 1.38
400 1.08 0.85 1.38
405 1.08 0.84 1.39
413 1.09 0.84 1.41
414 1.09 0.84 1.41
420 1.09 0.83 1.43
425 1.09 0.83 1.44
432 1.10 0.83 1.45
434 1.10 0.83 1.46
435 1.10 0.83 1.46
440 1.10 0.82 1.47
441 1.10 0.82 1.47
450 1.11 0.82 1.50
452 1.11 0.82 1.50
455 1.11 0.82 1.51
462 1.11 0.81 1.53
475 1.12 0.81 1.56
480 1.12 0.80 1.57
483 1.13 0.80 1.58
490 1.13 0.80 1.60
495 1.13 0.80 1.61
500 1.13 0.79 1.62
510 1.14 0.79 1.65
520 1.15 0.78 1.68
525 1.15 0.78 1.69
532 1.15 0.78 1.71
540 1.16 0.77 1.73
546 1.16 0.77 1.75
550 1.16 0.77 1.76
560 1.17 0.76 1.79
570 1.18 0.76 1.82
585 1.18 0.75 1.87
595 1.19 0.75 1.90
596 1.19 0.75 1.90
600 1.19 0.74 1.91
615 1.20 0.74 1.96
625 1.21 0.73 1.99
630 1.21 0.73 2.01
640 1.22 0.73 2.04
660 1.23 0.72 2.11
665 1.23 0.71 2.13
675 1.24 0.71 2.16
690 1.25 0.70 2.21
700 1.25 0.70 2.25
720 1.27 0.69 2.33

Code:
mkspline VPA_min_knots = VPA_min, cubic knots(10 150 270) displayknots
mat knots= r(knots)
svy linearized: stcox VPA_min_knots* sex age education_cat bmi srvy_yr alcohol smoking marital_cat race limitations condition strength MPA_min
testparm VPA_min_knots1 VPA_min_knots2
levelsof VPA_min
xbrcspline VPA_min_knots, values(`r(levels)') ref(150) matknots(knots)eform
predictnl xb= _b[VPA_min_knots1]*(VPA_min_knots1-150)+ _b[VPA_min_knots2]*(VPA_min_knots2-150), ci(lo hi)
gen hr = exp(xb)
gen lb = exp(lo)
gen ub = exp(hi)
sort VPA_min
graph tw line hr VPA_min, color(navy) ylabel(0.75 1 1.5) ///
|| rarea lb ub VPA_min, color(navy%30) ///
yline(1) yscale(log) ytitle("Hazard Ratio") xtitle("VPA (weekly minutes)") ///
xlabel(0(100)720) title({bf:VPA and alzheimer mortality})
These are the values I am getting with the xbrcspline command and below the plot for the spline.
VPA_min exp(XB) LB UB
0 1.28 1.06 1.55
10 1.26 1.06 1.50
11 1.25 1.06 1.49
12 1.25 1.06 1.49
13 1.25 1.05 1.48
14 1.25 1.05 1.47
15 1.24 1.05 1.47
16 1.24 1.05 1.46
17 1.24 1.05 1.46
18 1.24 1.05 1.45
19 1.23 1.05 1.45
20 1.23 1.05 1.44
22 1.23 1.05 1.43
23 1.22 1.05 1.43
24 1.22 1.05 1.42
25 1.22 1.05 1.41
26 1.22 1.05 1.41
27 1.21 1.05 1.40
28 1.21 1.05 1.40
29 1.21 1.05 1.39
30 1.21 1.05 1.39
32 1.20 1.05 1.38
33 1.20 1.04 1.37
34 1.20 1.04 1.37
35 1.19 1.04 1.36
36 1.19 1.04 1.36
37 1.19 1.04 1.35
38 1.19 1.04 1.35
39 1.18 1.04 1.34
40 1.18 1.04 1.34
42 1.18 1.04 1.33
44 1.17 1.04 1.32
45 1.17 1.04 1.32
46 1.17 1.04 1.31
48 1.16 1.04 1.30
49 1.16 1.04 1.30
50 1.16 1.04 1.29
51 1.16 1.04 1.29
52 1.15 1.04 1.28
53 1.15 1.04 1.28
54 1.15 1.03 1.27
55 1.15 1.03 1.27
56 1.14 1.03 1.27
57 1.14 1.03 1.26
58 1.14 1.03 1.26
60 1.14 1.03 1.25
64 1.13 1.03 1.23
65 1.12 1.03 1.23
66 1.12 1.03 1.22
68 1.12 1.03 1.22
69 1.12 1.03 1.21
70 1.11 1.03 1.21
72 1.11 1.03 1.20
74 1.11 1.03 1.19
75 1.10 1.03 1.19
76 1.10 1.02 1.18
77 1.10 1.02 1.18
78 1.10 1.02 1.18
80 1.09 1.02 1.17
81 1.09 1.02 1.17
82 1.09 1.02 1.16
84 1.09 1.02 1.16
85 1.08 1.02 1.15
87 1.08 1.02 1.15
88 1.08 1.02 1.14
90 1.08 1.02 1.14
91 1.07 1.02 1.13
92 1.07 1.02 1.13
93 1.07 1.02 1.13
96 1.07 1.02 1.12
98 1.06 1.02 1.11
99 1.06 1.01 1.11
100 1.06 1.01 1.10
102 1.06 1.01 1.10
104 1.05 1.01 1.09
105 1.05 1.01 1.09
106 1.05 1.01 1.09
108 1.05 1.01 1.08
110 1.04 1.01 1.08
111 1.04 1.01 1.07
112 1.04 1.01 1.07
114 1.04 1.01 1.07
117 1.03 1.01 1.06
119 1.03 1.01 1.06
120 1.03 1.01 1.05
121 1.03 1.01 1.05
124 1.02 1.01 1.04
125 1.02 1.01 1.04
126 1.02 1.01 1.04
128 1.02 1.00 1.04
129 1.02 1.00 1.03
130 1.02 1.00 1.03
132 1.02 1.00 1.03
133 1.01 1.00 1.03
135 1.01 1.00 1.02
136 1.01 1.00 1.02
138 1.01 1.00 1.02
140 1.01 1.00 1.01
141 1.01 1.00 1.01
144 1.00 1.00 1.01
145 1.00 1.00 1.01
147 1.00 1.00 1.00
148 1.00 1.00 1.00
150 1.00 1.00 1.00
152 1.00 1.00 1.00
154 1.00 0.99 1.00
156 1.00 0.99 1.00
159 0.99 0.99 1.00
160 0.99 0.99 1.00
161 0.99 0.99 1.00
162 0.99 0.99 1.00
165 0.99 0.98 1.00
168 0.99 0.98 1.00
170 0.99 0.98 1.00
171 0.99 0.98 1.00
172 0.99 0.98 1.00
174 0.99 0.97 1.00
175 0.99 0.97 1.00
176 0.99 0.97 1.00
177 0.99 0.97 1.00
180 0.99 0.97 1.00
182 0.99 0.97 1.01
184 0.99 0.97 1.01
185 0.99 0.97 1.01
188 0.99 0.96 1.01
189 0.99 0.96 1.01
190 0.99 0.96 1.01
192 0.99 0.96 1.01
195 0.99 0.96 1.01
196 0.99 0.96 1.01
198 0.99 0.96 1.02
200 0.99 0.96 1.02
203 0.99 0.95 1.02
204 0.99 0.95 1.02
207 0.99 0.95 1.02
208 0.99 0.95 1.03
210 0.99 0.95 1.03
212 0.99 0.95 1.03
216 0.99 0.95 1.03
217 0.99 0.95 1.04
220 0.99 0.94 1.04
222 0.99 0.94 1.04
224 0.99 0.94 1.04
225 0.99 0.94 1.05
228 0.99 0.94 1.05
230 0.99 0.94 1.05
231 0.99 0.94 1.05
234 1.00 0.94 1.06
235 1.00 0.94 1.06
238 1.00 0.93 1.06
240 1.00 0.93 1.07
244 1.00 0.93 1.07
245 1.00 0.93 1.07
250 1.00 0.93 1.08
252 1.00 0.93 1.09
255 1.00 0.92 1.09
259 1.01 0.92 1.10
260 1.01 0.92 1.10
264 1.01 0.92 1.11
265 1.01 0.92 1.11
266 1.01 0.92 1.11
268 1.01 0.92 1.11
270 1.01 0.92 1.12
273 1.01 0.91 1.12
275 1.01 0.91 1.13
280 1.02 0.91 1.14
285 1.02 0.91 1.14
288 1.02 0.91 1.15
290 1.02 0.91 1.15
300 1.03 0.90 1.17
308 1.03 0.90 1.19
315 1.03 0.89 1.20
318 1.04 0.89 1.21
320 1.04 0.89 1.21
322 1.04 0.89 1.22
325 1.04 0.89 1.22
329 1.04 0.88 1.23
330 1.04 0.88 1.23
336 1.05 0.88 1.24
340 1.05 0.88 1.25
345 1.05 0.87 1.26
350 1.05 0.87 1.27
356 1.06 0.87 1.28
357 1.06 0.87 1.29
360 1.06 0.87 1.29
364 1.06 0.86 1.30
371 1.06 0.86 1.32
375 1.07 0.86 1.32
378 1.07 0.86 1.33
380 1.07 0.86 1.34
385 1.07 0.85 1.35
390 1.07 0.85 1.36
392 1.08 0.85 1.36
399 1.08 0.85 1.38
400 1.08 0.85 1.38
405 1.08 0.84 1.39
413 1.09 0.84 1.41
414 1.09 0.84 1.41
420 1.09 0.83 1.43
425 1.09 0.83 1.44
432 1.10 0.83 1.45
434 1.10 0.83 1.46
435 1.10 0.83 1.46
440 1.10 0.82 1.47
441 1.10 0.82 1.47
450 1.11 0.82 1.50
452 1.11 0.82 1.50
455 1.11 0.82 1.51
462 1.11 0.81 1.53
475 1.12 0.81 1.56
480 1.12 0.80 1.57
483 1.13 0.80 1.58
490 1.13 0.80 1.60
495 1.13 0.80 1.61
500 1.13 0.79 1.62
510 1.14 0.79 1.65
520 1.15 0.78 1.68
525 1.15 0.78 1.69
532 1.15 0.78 1.71
540 1.16 0.77 1.73
546 1.16 0.77 1.75
550 1.16 0.77 1.76
560 1.17 0.76 1.79
570 1.18 0.76 1.82
585 1.18 0.75 1.87
595 1.19 0.75 1.90
596 1.19 0.75 1.90
600 1.19 0.74 1.91
615 1.20 0.74 1.96
625 1.21 0.73 1.99
630 1.21 0.73 2.01
640 1.22 0.73 2.04
660 1.23 0.72 2.11
665 1.23 0.71 2.13
675 1.24 0.71 2.16
690 1.25 0.70 2.21
700 1.25 0.70 2.25
720 1.27 0.69 2.33
Code:
mkspline VPA_min_knots = VPA_min, cubic knots(10 150 270) displayknots
mat knots= r(knots)
svy linearized: stcox VPA_min_knots* sex age education_cat bmi srvy_yr alcohol smoking marital_cat race limitations condition strength MPA_min
testparm VPA_min_knots1 VPA_min_knots2
levelsof VPA_min
xbrcspline VPA_min_knots, values(`r(levels)') ref(150) matknots(knots)eform
predictnl xb= _b[VPA_min_knots1]*(VPA_min_knots1-150)+ _b[VPA_min_knots2]*(VPA_min_knots2-150), ci(lo hi)
gen hr = exp(xb)
gen lb = exp(lo)
gen ub = exp(hi)
sort VPA_min
graph tw line hr VPA_min, color(navy) ylabel(0.75 1 1.5) ///
|| rarea lb ub VPA_min, color(navy%30) ///
yline(1) yscale(log) ytitle("Hazard Ratio") xtitle("VPA (weekly minutes)") ///
xlabel(0(100)720) title({bf:VPA and alzheimer mortality})