1

I'm currently working on a project for which I need to differ my main explanatory variable. I'm building an individual fixed effects model with plm and need to "cut in half" a variable. Unfortunately I can't provide a repex but a part of the code.

low_troop <- plm(POLSTAB ~ US +  RDURAB + DEMOC + POP,  data = US, index = c('COUNTRY'), model = 'within', effect = "individual")
high_troop <- plm(POLSTAB ~ US+  RDURAB + DEMOC + POP,  data = US, index = c('COUNTRY'), model = 'within', effect = "individual"

In my panel data, US is the number of US Soldiers abroad. I'd love to have one plm for all data where the value for US is >100 and one for US value <100. Is this possible without creating a new dataset?

Thank you all so much for your help.

Regards,

Lawrence

1 Answer 1

0

Just subset data in the data= argument; example:

library(plm)
data(Grunfeld)

wi.lo <- plm(inv ~ value + capital, data=Grunfeld[Grunfeld$value >= 1000,], 
          index="firm", model="within", effect="individual")
wi.hi <- plm(inv ~ value + capital, data=Grunfeld[Grunfeld$value < 1000,], 
          index="firm", model="within", effect="individual")

summary(wi.lo)$coef
#          Estimate Std. Error   t-value     Pr(>|t|)
# value   0.1132322 0.02024847  5.592138 6.934243e-07
# capital 0.3455339 0.03022447 11.432257 2.868412e-16

summary(wi.hi)$coef
#           Estimate Std. Error  t-value     Pr(>|t|)
# value   0.09465974 0.01115671 8.484558 4.579648e-14
# capital 0.09808216 0.01249071 7.852408 1.431317e-12
Sign up to request clarification or add additional context in comments.

Comments

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.