Open ellessenne opened 2 weeks ago
thank you! yes, this is not supported. will put a stop criterion in unless you want to fix the bug?
best T
Alessandro Gasparini @.***> writes:
Hi,
I think I have found a bug when using the
FGR()
function and when the model formula contains other functions (e.g., splinesns()
or polynomialspoly()
):library(riskRegression) #> riskRegression version 2023.12.21 library(prodlim) library(survival) library(cmprsk) d <- prodlim::SimCompRisk(100) f1 <- FGR(Hist(time, cause) ~ X1 + X2, data = d) #> Argument cause missing. Analyse cause: 1 print(f1) #> #> Right-censored response of a competing.risks model #> #> No.Observations: 100 #> #> Pattern: #> #> Cause event right.censored #> 1 47 0 #> 2 25 0 #> unknown 0 28 #> #> #> Fine-Gray model: analysis of cause 1 #> #> Competing Risks Regression #> #> Call: #> FGR(formula = Hist(time, cause) ~ X1 + X2, data = d, cause = "1") #> #> coef exp(coef) se(coef) z p-value #> X1 1.232 3.43 0.294 4.19 2.7e-05 #> X2 0.913 2.49 0.154 5.93 3.0e-09 #> #> exp(coef) exp(-coef) 2.5% 97.5% #> X1 3.43 0.292 1.93 6.10 #> X2 2.49 0.401 1.84 3.37 #> #> Num. cases = 100 #> Pseudo Log-likelihood = -170 #> Pseudo likelihood ratio test = 40.6 on 2 df, #> #> Convergence: TRUE library(splines) FGR(Hist(time, cause) ~ X1 + ns(X2, df = 3), data = d) #> Error in str2lang(termtext): <text>:2:0: unexpected end of input #> 1: X1+ns(X2 #> ^ FGR(Hist(time, cause) ~ X1 + poly(X2, degree = 2), data = d) #> Error in str2lang(termtext): <text>:2:0: unexpected end of input #> 1: X1+poly(X2 #> ^
Note that no error happens if I use
I()
instead, I think it may due to the,
character breaking thestr2lang
call?FGR(Hist(time, cause) ~ X1 + X2 + I(X2^2), data = d) #> Argument cause missing. Analyse cause: 1 #> #> Right-censored response of a competing.risks model #> #> No.Observations: 100 #> #> Pattern: #> #> Cause event right.censored #> 1 47 0 #> 2 25 0 #> unknown 0 28 #> #> #> Fine-Gray model: analysis of cause 1 #> #> Competing Risks Regression #> #> Call: #> FGR(formula = Hist(time, cause) ~ X1 + X2 + I(X2^2), data = d, #> cause = "1") #> #> coef exp(coef) se(coef) z p-value #> X1 1.2217 3.39 0.2964 4.121 3.8e-05 #> X2 0.8504 2.34 0.1724 4.932 8.1e-07 #> I(X2^2) 0.0638 1.07 0.0923 0.691 4.9e-01 #> #> exp(coef) exp(-coef) 2.5% 97.5% #> X1 3.39 0.295 1.898 6.07 #> X2 2.34 0.427 1.669 3.28 #> I(X2^2) 1.07 0.938 0.889 1.28 #> #> Num. cases = 100 #> Pseudo Log-likelihood = -170 #> Pseudo likelihood ratio test = 41 on 3 df, #> #> Convergence: TRUE
I know I can pre-compute the spline expansion, so that would be a workaround, but I thought about reporting this issue anyway. Hope this helps!
Alessandro
-- 7LL-5 Don’t compare your life with others, you have no idea what their journey is all about.
I can have a look into it!
Hi,
I think I have found a bug when using the
FGR()
function and when the model formula contains other functions (e.g., splinesns()
or polynomialspoly()
):Note that no error happens if I use
I()
instead, I think it may due to the,
character breaking thestr2lang
call?I know I can pre-compute the spline expansion, so that would be a workaround, but I thought about reporting this issue anyway. Hope this helps!
Alessandro