I am trying to model the following interrupted time series model:
y = b0 + b1*time + b2*event + b3*time_since_event
The data, however, is nested inside users (id). Currently, I have the following nlme model specification:
m = lme(y ~ time + event + time_since_event, random=~1+time|id, correlation = corAR1(), data=df)
Is the above model possible in plm at all? I tried the following:
m = plm(
+ y ~ time + event + time_since_event,
+ data = pd_df,
+ model = 'within',
+ effect = 'twoways'
+ )
But it throws the following error:
Error in plm.fit(data, model, effect, random.method, random.models, random.dfcor, (r_v1.R#361): empty model
Show stack trace
Not sure if I plm is not suited for interrupted time series analysis like the one mentioned here.
dput(your dataframe)and copy and paste it above. Alternatively, use pastebin, or make a mock dataset for us to use, otherwise we can't help you