0

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.

2
  • 1
    Any sample data to reproduce the error at our end? Commented Mar 3, 2024 at 18:54
  • please write 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 Commented Mar 5, 2024 at 10:36

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.