drizopoulos / JM

Joint Models for Longitudinal & Survival Data under Maximum Likelihood
34 stars 7 forks source link

Trouble with specifying integral form for cumulative effects model #26

Closed agstone90 closed 3 years ago

agstone90 commented 3 years ago

Hi Dr. Rizopoulos, thanks again for all the help!

I am trying to fit a cumulative effects model based on the following lme object

<lme_fit<-lme(var~ns(time,3)+cov,random=~time|ID, data=data,control=lmeControl(opt="optim"))>

I haven't been able to get the derivForm argument right though. I've been trying

<iform<-list(fixed=~-1+time+ins(time,3)+(cov*time),indFixed=c(1:5), random=~-1+time+time^2/2,indRandom=c(1:2))>

and getting an error "Error in terms.formula(derivForm$random) : invalid model formula in ExtractVars"

Would you be able to provide any guidance as to what the correct syntax would be?

Thanks!

agstone90 commented 3 years ago

Sorry, not sure how I've managed to strikethrough my iform. It should read

iform<-list(fixed=~-1+time+ins(time,3)+(cov*time),indFixed=c(1:5), random=~-1+time+time^2/2,indRandom=c(1:2))

drizopoulos commented 3 years ago

You need a tilde to define a formula in R, i.e., fixed = ~...

—— Dimitris Rizopoulos Professor of Biostatistics Erasmus University Medical Center The Netherlands


From: agstone90 notifications@github.com Sent: Wednesday, December 16, 2020 3:37:21 AM To: drizopoulos/JM JM@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [drizopoulos/JM] Trouble with specifying integral form for cumulative effects model (#26)

Sorry, not sure how I've managed to strikethrough my iform. It should read

iform<-list(fixed=-1+time+ins(time,3)+(cov*time),indFixed=c(1:5), random=-1+time+time^2/2,indRandom=c(1:2))

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdrizopoulos%2FJM%2Fissues%2F26%23issuecomment-745725126&data=04%7C01%7Cd.rizopoulos%40erasmusmc.nl%7Caa6d2e318c774a85c59808d8a16b841c%7C526638ba6af34b0fa532a1a511f4ac80%7C0%7C0%7C637436830440424072%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=wrUU1gSg1LdEjRJgJujWxZ%2BokkiB6oBC2XJbMSqmtGE%3D&reserved=0, or unsubscribehttps://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FADE7TTY2NY5ACNDDLOCILNDSVAMODANCNFSM4U5JEZVQ&data=04%7C01%7Cd.rizopoulos%40erasmusmc.nl%7Caa6d2e318c774a85c59808d8a16b841c%7C526638ba6af34b0fa532a1a511f4ac80%7C0%7C0%7C637436830440434020%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Jc8WHsXJcb5a8nONauAuVOM%2FN97urP%2FkNHMN84Ytgng%3D&reserved=0.

agstone90 commented 3 years ago

Thanks! Managed to delete it when copy/pasting code, but adding an I() operation got it to work.