'Time-dependent covariates- is there something wrong with this code? (R program)

I am checking a few of my Cox multivariate regression analyses' proportional hazard assumptions using time-dependent co-variates, using the survival package. The question is looking at survival in groups with different ADAMTS13 levels (a type of enzyme).

Could I check if something is wrong with my code itself? It keeps saying Error in tt(TMAdata$ADAMTS13level.f) : could not find function "tt" . Why?

Notably, ADAMTS13level.f is a factor variable.

cox_multivariate_survival_ADAMTS13 <- coxph(Surv(TMAdata$Daysalive, TMAdata$'Dead=1')
                                                        ~TMAdata$ADAMTS13level.f
                                                        +TMAdata$`Age at diagnosis`
                                                        +TMAdata$CCIwithoutage
                                                        +TMAdata$Gender.f
                                                        +TMAdata$`Peak Creatinine`
                                                        +TMAdata$DICorcrit.f,
                                                        tt(TMAdata$ADAMTS13level.f), 
                                                        tt = function(x, t, ...)
                                                        {mtrx <- model.matrix(~x)[,-1] 
                                                         mtrx * log(t)})

Thanks- starting with the fundamentals of my actual code or typos- I have tried different permutations to no avail yet.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source