Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How add mixed effects to a cox model? #55

Open
casasgomezuribarri opened this issue Sep 12, 2023 · 2 comments
Open

How add mixed effects to a cox model? #55

casasgomezuribarri opened this issue Sep 12, 2023 · 2 comments

Comments

@casasgomezuribarri
Copy link

I want to add random effects to my Cox model formulation, and I have noticed that

cox1 = coxph(@formula(event ~ A + B + C + (1|D)), data) 

produces the following error:

ERROR: MethodError: no method matching |(::Int64, ::String)
Closest candidates are:
|(::Any, ::Any, ::Any, ::Any...) at operators.jl:591
|(::T, ::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:365
|(::T, ::CEnum.Cenum{S}) where {T<:Integer, S<:Integer} at ~/.julia/packages/CEnum/Bqafi/src/operators.jl:13

but this syntax is allowed in @formula (i.e., the following works fine):

@formula(event ~ A + B + C + (1|D))

I assume mixed effects aren't supported in coxph?

For reference, random effects in survival analysis are often referred to as 'frailty terms' (in fact, I think in R they are added as frailty(D) as opposed to 1|D, but I'm not sure.

Is this something that is supported but I'm just doing it wrong?

@casasgomezuribarri
Copy link
Author

further reference, in case it's helpful:

https://stats.oarc.ucla.edu/r/dae/mixed-effects-cox-regression/

@ararslan
Copy link
Member

ararslan commented Jan 4, 2024

Hi @casasgomezuribarri, apologies for the delayed response. Mixed effects are not currently supported by this package though it's something I'd like to incorporate eventually.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants