-
Notifications
You must be signed in to change notification settings - Fork 24
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
issue with survfitJM #104
Comments
Check JMbayes2
——
Professor of Biostatistics
Erasmus Medical Center Rotterdam
The Netherlands
…________________________________
Από: huyendn ***@***.***>
Στάλθηκε: Thursday, August 10, 2023 2:57:10 PM
Προς: drizopoulos/JMbayes ***@***.***>
Κοιν.: Subscribed ***@***.***>
Θέμα: [drizopoulos/JMbayes] issue with survfitJM (Issue #104)
Waarschuwing: Deze e-mail is afkomstig van buiten de organisatie. Klik niet op links en open geen bijlagen, tenzij u de afzender herkent en weet dat de inhoud veilig is.
Caution: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
I got this error when trying to fit the dynamic prediction
Error in contrasts<-(*tmp*, value = contr.funs[1 + isOF[nn]]) :
contrasts can be applied only to factors with 2 or more levels
I know this error occurs when the categorical only has 1 level. However, if we do prediction for one patient, a categorical could have only 1 level for that patient. In your example code (https://erandrinopoulou.github.io/EducationalCorner_JMpred/) , the data for the patient for prediction has some categorical with one level. Could you please help look into this?
—
Reply to this email directly, view it on GitHub<#104>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/ADE7TTZPCIH7KSIKN6OYT4LXUUVINANCNFSM6AAAAAA3L5PS6Y>.
You are receiving this because you are subscribed to this thread.Message ID: ***@***.***>
|
Thanks for the fast response. I just tried predict function in JMbayes2 with jm object and still got the same message error.
Error in |
Hello, Do you know what might possibly cause this issue? Thank you |
Hi, I encountered the same problem recently and solved by converting categorical variables to factors. You may also want to check if each of the factors is with 2 or more levels. Hope this helps. |
Make sure in "newdata_5" you are defining your factor variables to have two levels even if you're predicting with only one level. For example, if you have 2 time points and your categorical variable is gender, define it as: newdata_5$gender <- factor(c('female','female'), levels = c('female','male')) |
I got this error when trying to fit the dynamic prediction
Error in
contrasts<-
(*tmp*
, value = contr.funs[1 + isOF[nn]]) :contrasts can be applied only to factors with 2 or more levels
I know this error occurs when the categorical only has 1 level. However, if we do prediction for one patient, a categorical could have only 1 level for that patient. In your example code (https://erandrinopoulou.github.io/EducationalCorner_JMpred/) , the data for the patient for prediction has some categorical with one level. Could you please help look into this?
The text was updated successfully, but these errors were encountered: