0

I am given example that comp() should be returning p-vals but it ends up returning ranks so let me ask:enter image description here
Why is comp() function from survmisc package returning ranks instead of p-values?
Is there a way to change it?

test_drug <- survfit(Surv(N_Days,Cens) ~ Drug, data = df)
comp(ten(test_drug), p=c(0,1,1,0.5,0.5),q=c(1,0,1,0.5,2))

output:

                        Q        Var       Z pNorm
1              3.3457e+00 2.7643e+01 0.63634     4
n              3.2000e+02 1.0304e+06 0.31524    10
sqrtN          3.4634e+01 4.8218e+03 0.49877     9
S1             2.1524e+00 1.6867e+01 0.52410     7
S2             2.1294e+00 1.6650e+01 0.52185     8
FH_p=0_q=1     1.1647e+00 2.2356e+00 0.77898     3
FH_p=1_q=0     2.1809e+00 1.7056e+01 0.52809     6
FH_p=1_q=1     8.4412e-01 7.9005e-01 0.94968     1
FH_p=0.5_q=0.5 1.6895e+00 4.1759e+00 0.82678     2
FH_p=0.5_q=2   2.7491e-01 2.2027e-01 0.58575     5
                  maxAbsZ        Var       Q pSupBr
1              5.8550e+00 2.7643e+01 1.11361      5
n              9.7000e+02 1.0304e+06 0.95556      6
sqrtN          6.3636e+01 4.8218e+03 0.91643      7
S1             3.5891e+00 1.6867e+01 0.87391      9
S2             3.5737e+00 1.6650e+01 0.87581      8
FH_p=0_q=1     2.2539e+00 2.2356e+00 1.50743      2
FH_p=1_q=0     3.6025e+00 1.7056e+01 0.87230     10
FH_p=1_q=1     1.4726e+00 7.9005e-01 1.65678      1
FH_p=0.5_q=0.5 2.9457e+00 4.1759e+00 1.44148      3
FH_p=0.5_q=2   6.3430e-01 2.2027e-01 1.35150      4
rkabuk
  • 267
  • 3
  • 15
  • 1
    I do not see anything in the help page for survMisc::comp that claims a p-value will be returned. You should be asking someone with more statistical knowledge to work with you to develop a plan to address the issues that your analysis requires. Suggesting migration. – IRTFM Feb 25 '22 at 05:02
  • @IRTFM The output seems to depend on the model (different behavior for continuous and categorical predictors) and the values of `p` and `q`. One of the examples in `help("comp")` shows p-values. – Roland Feb 25 '22 at 06:36
  • What I saw said Z scores were returned. The fact that z-scores and p-values have a 1-1 correspondence was what I was hoping the OP would learn if he asked the question in the right venue. – IRTFM Feb 25 '22 at 15:40
  • Many thanks for engagement into solving the topic! I've found solution to this. p-vals are ranked not printed due to R version usage. Previous verious of R should solve the problem. below ive posted how to access p-vals :) – rkabuk Feb 26 '22 at 11:47

1 Answers1

0

So according to the topic here:
https://github.com/dardisco/survMisc/issues/21

And information that I got from the profesor lecturer who solved the problem earlier. This is issue with R version and update is required to the fuction itself by authors or contributors.

This can be solves using attr() func with 'tft' parameter standing for test for trend. Code example here:

test_bilirubin <- survfit(Surv(N_Days,Cens) ~ Bilirubin_cat, data = df)
b=ten(test_bilirubin)
comp(b,p=c(0,1,1,0.5,0.5),q=c(1,0,1,0.5,2))
d=attr(b,"tft")
# "lrt" - the long-rank family of tests 
#"sup" - Renyi test, 
#"tft" - test for trend 
cbind(d$tft$W,round(d$tft$pChisq,4))
rkabuk
  • 267
  • 3
  • 15