Hi everyone,
Anyone has ever done "strs" to calculate the relative survival in Stata may help me through this.
According to this formula :
/* SE of P */
gen var_Lambda=(end-start)^2*d/y^2
gen se_p=p*sqrt(var_Lambda)
/* SE of CP */
`byby' gen var_cLambda=sum( (end-start)^2*d/y^2 )
gen se_cp=cp*sqrt(var_cLambda)
I try to work out the standard error based on the N, d, y , p and cp. However, I don't get the same result as strs. Please see the example below.
This results from strs
This is my working
Has anyone got a clue, please help me.
Thanks
Anyone has ever done "strs" to calculate the relative survival in Stata may help me through this.
According to this formula :
/* SE of P */
gen var_Lambda=(end-start)^2*d/y^2
gen se_p=p*sqrt(var_Lambda)
/* SE of CP */
`byby' gen var_cLambda=sum( (end-start)^2*d/y^2 )
gen se_cp=cp*sqrt(var_cLambda)
I try to work out the standard error based on the N, d, y , p and cp. However, I don't get the same result as strs. Please see the example below.
This results from strs
sex | start | end | n | d | d_star | y | p | p_star | cp | cp_e2 | se_p | se_cp | se_cr_e2 |
1 | 0 | 1 | 78093 | 13010 | 1370.5 | 58393.9 | 0.8003 | 0.9754 | 0.8003 | 0.9754 | 0.0016 | 0.0016 | 0.0016 |
1 | 1 | 2 | 61430 | 5081 | 1155.9 | 48837.8 | 0.9012 | 0.9763 | 0.7212 | 0.9523 | 0.0013 | 0.0018 | 0.0018 |
1 | 2 | 3 | 53310 | 3065 | 1069.1 | 43264.8 | 0.9316 | 0.9755 | 0.6719 | 0.9289 | 0.0012 | 0.0019 | 0.002 |
1 | 3 | 4 | 47797 | 2295 | 1011.4 | 38931 | 0.9428 | 0.9742 | 0.6334 | 0.905 | 0.0012 | 0.0019 | 0.0021 |
1 | 4 | 5 | 42780 | 1907 | 946.4 | 34737.4 | 0.9466 | 0.9729 | 0.5996 | 0.8805 | 0.0012 | 0.002 | 0.0022 |
2 | 0 | 1 | 58176 | 8218 | 621.2 | 44263.9 | 0.8306 | 0.9846 | 0.8306 | 0.9846 | 0.0017 | 0.0017 | 0.0017 |
2 | 1 | 2 | 47425 | 3162 | 524.2 | 38082.1 | 0.9203 | 0.9861 | 0.7644 | 0.9709 | 0.0014 | 0.0019 | 0.002 |
2 | 2 | 3 | 42485 | 1948 | 486.8 | 34477.8 | 0.9451 | 0.9858 | 0.7224 | 0.9572 | 0.0012 | 0.002 | 0.0021 |
2 | 3 | 4 | 38479 | 1407 | 464.3 | 31496.8 | 0.9563 | 0.9853 | 0.6908 | 0.9431 | 0.0011 | 0.0021 | 0.0022 |
2 | 4 | 5 | 35215 | 1204 | 439.4 | 28760.5 | 0.959 | 0.9848 | 0.6625 | 0.9288 | 0.0012 | 0.0022 | 0.0024 |
sex | start | end | n | d | d_star | y | p | p_star | cp | cp_e2 | var_Lambda | se_p | var_cLambda | se_cp |
1 | 0 | 1 | 78093 | 13010 | 1370.5 | 58393.9 | 0.8003 | 0.9754 | 0.8003 | 0.9754 | 3.81542E-06 | 0.0016 | 3.81542E-06 | 0.0026 |
1 | 1 | 2 | 61430 | 5081 | 1155.9 | 48837.8 | 0.9012 | 0.9763 | 0.7212 | 0.9523 | 2.13028E-06 | 0.0013 | 2.13028E-06 | 0.0024 |
1 | 2 | 3 | 53310 | 3065 | 1069.1 | 43264.8 | 0.9316 | 0.9755 | 0.6719 | 0.9289 | 1.63742E-06 | 0.0012 | 1.63742E-06 | 0.0022 |
1 | 3 | 4 | 47797 | 2295 | 1011.4 | 38931 | 0.9428 | 0.9742 | 0.6334 | 0.905 | 1.51423E-06 | 0.0012 | 1.51423E-06 | 0.0021 |
1 | 4 | 5 | 42780 | 1907 | 946.4 | 34737.4 | 0.9466 | 0.9729 | 0.5996 | 0.8805 | 1.58036E-06 | 0.0012 | 1.58036E-06 | 0.0020 |
2 | 0 | 1 | 58176 | 8218 | 621.2 | 44263.9 | 0.8306 | 0.9846 | 0.8306 | 0.9846 | 4.19437E-06 | 0.0017 | 4.19437E-06 | 0.0027 |
2 | 1 | 2 | 47425 | 3162 | 524.2 | 38082.1 | 0.9203 | 0.9861 | 0.7644 | 0.9709 | 2.18032E-06 | 0.0014 | 2.18032E-06 | 0.0025 |
2 | 2 | 3 | 42485 | 1948 | 486.8 | 34477.8 | 0.9451 | 0.9858 | 0.7224 | 0.9572 | 1.63874E-06 | 0.0012 | 1.63874E-06 | 0.0024 |
2 | 3 | 4 | 38479 | 1407 | 464.3 | 31496.8 | 0.9563 | 0.9853 | 0.6908 | 0.9431 | 1.41828E-06 | 0.0011 | 1.41828E-06 | 0.0023 |
2 | 4 | 5 | 35215 | 1204 | 439.4 | 28760.5 | 0.959 | 0.9848 | 0.6625 | 0.9288 | 1.45557E-06 | 0.0012 | 1.45557E-06 | 0.0022 |
Thanks
Comment