Panel Data and Fixed Effects in R

Panel Data and Fixed Effects in R

SebastianWaiEcon

4 года назад

67,836 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@allthingswebdev
@allthingswebdev - 22.09.2023 19:49

Thank you for this.

Ответить
@sima231
@sima231 - 18.05.2023 20:13

Hello, how do I include country-fixed effects in my mulivariate logistic regression? Is it also the plm function? Looking forward for an answer.

Ответить
@chibuikegerald4988
@chibuikegerald4988 - 10.04.2023 19:57

Hi Seb
what if I want to create a dummy variable between high income countries and low income countries from WDI
How do i specifically do these on the ground of GDP~INTEREST_RATE, I'm having a difficult time searching for income in relation to this and creating dummies for it.

someone please help out

Ответить
@user-tm8oj9ut6x
@user-tm8oj9ut6x - 20.03.2023 22:59

Hello,
Thanks for your video. I have currently the task to analyze company data on buyouts. Here I have the financial information for multiple companies at different time series. For example company A has the financial information from 2005 - 2010, company B has financial information from 2008-2010 etc. So the number of years I got for the different companies differ and the timespan where I got the financial information from. How should I treat data like this? Could you please give me a hint? Thanks in advance.

Ответить
@hannahlui2854
@hannahlui2854 - 22.01.2023 14:35

Thank you Sebastian, I had a quick question on standard errors - do we get the same standard errors regardless of whether we use lm or plm?

Ответить
@srcmaddin
@srcmaddin - 03.11.2022 11:54

Excellent Video. Sebastian is there a way to visualize a Multiple Linear Regression with Fixed Effects? I want to do a regression curve in a plot that considers fixed effects.

Ответить
@shannoncoates9826
@shannoncoates9826 - 27.08.2022 17:53

are you using both time and state fixed effects in your LSDV estimation?

Ответить
@luftetaralija3941
@luftetaralija3941 - 24.08.2022 02:20

Thank you this really was helpful! I’ve got one question: Why is the intercept coefficient estimate missing in the plm function?

Ответить
@oddsenHELL
@oddsenHELL - 20.05.2022 15:51

Any tip on how to do the regression if I want to analyze 2 groups of countries across 50 years, devided into 5 decades and show the result seperatly for each country for each decade. That is the coefficients for the independet variables effect on the dependend variable, for each country (id) for each decade

Ответить
@SuarezNr7Lfc
@SuarezNr7Lfc - 17.05.2022 14:55

How do I get an intercept when doing a within model?

Ответить
@vadersfist1775
@vadersfist1775 - 24.04.2022 02:16

I have a very similar set of data but i have the problem when doing the fixed effects model using a dummy variable. I have data from two different years. Problem is, in the summary you should see the result of every year using factor(year) but it always shows only the results of one year instead of both. I really don't know what is wrong. I did it exactly the same way you did it. And unfortunately it doesn't work either when i replace the number of the year with a word. Quite strange. Do you know what the problem could be?
Edit: Ah, I just realized the second row is always the first result. Your results started with 1970 but the first result directly under legal is 1971 and not 1970

Ответить
@user-zn5vl4bk7r
@user-zn5vl4bk7r - 11.04.2022 08:58

Hi! Thank u so much for the video, but what if I was given the dummy variables to use?

Ответить
@nez01
@nez01 - 11.04.2022 02:18

this was very detailed thank you! but a quick question: you did show how to get year-specific intercepts and I assume that's the same way to get state-specific intercepts but, what if we're looking for a year-state specific intercept?

Ответить
@luizabpr
@luizabpr - 25.02.2022 14:11

Thank you very much. I have two questions: 1) can I use a lagged variable in fixed effects panel model, either with lm(xxx) or plm()? For examplo, can I use mrate(-1)? And 2) Suppose I am interested in testing if all the "state" dummies are jointly significant. Should I use a F test?

Ответить
@peacefulsoul76
@peacefulsoul76 - 08.12.2021 19:37

I need help as soon as possible

Ответить
@peacefulsoul76
@peacefulsoul76 - 08.12.2021 19:36

Which stata version you are using, I am not able to use these commands

Ответить
@mappy54
@mappy54 - 01.12.2021 18:57

thank you!!!!!!!!! <3

Ответить
@cccloud8079
@cccloud8079 - 30.11.2021 20:29

This is really helpful! Thanks a lot!!

Ответить
@therpope
@therpope - 18.11.2021 16:00

In short I Control for state in the within function. What if I’m interested not in years but states?

Ответить
@ramonkonig5166
@ramonkonig5166 - 16.11.2021 21:33

Thanks for the video. I am pretty new to the topic and was wondering if it would make sense to do a fixed effects regression in either of the following cases:

1. When the independent variable is different for every observation
2. When the independent variable can only be in one of two groups (and therefore is a dummy)

Would appreciate your reply a lot, thank you!

Ответить
@sharmasuraj858
@sharmasuraj858 - 08.11.2021 22:24

Can you please explain the dummy variable treatment in random effects? I want to understand the random effects across time. what should I do?

Ответить
@AviatorStone
@AviatorStone - 30.10.2021 03:19

I'm getting the following error when I use index="state" fixed effect: Error in solve.default(vcov(x)[names(coefs_wo_int), names(coefs_wo_int)], : Lapack routine dgesv: system is exactly singular: U[1,1] = 0

Ответить
@sarahs6247
@sarahs6247 - 18.10.2021 17:47

thank you so much for your explanation can you help me with this error:
Error in plm.fit(data, model, effect, random.method, random.models, random.dfcor, : empty model

Ответить
@mariazekio9592
@mariazekio9592 - 10.09.2021 20:31

Hello Sebastian! Excellent video! I would like your opinion. I want to define my X matrix and I want to include state FE and birth cohort FE. I tried the factor but then my matrix is not numeric and i get errors in my analysis due to that, what would you recommend ? So, my X right now, looks like this : X <- cbind.data.frame(dataGFE$epilllegal18,dataGFE$epillconsent18, dataGFE$eabortionlegal18,dataGFE$eabortionconsent18,dataGFE$hispanic, dataGFE$other, dataGFE$black, factor(dataGFE$state), factor(dataGFE$yob))

Ответить
@felipealvarado4390
@felipealvarado4390 - 10.09.2021 04:59

Thank you!

I have a question when you use fixed effect with plm.

For example, if i want to test de fixed state effect, my index would be only year? and if i want to test year fixed effect as your example, my index is state?


What happens if I want to test both, which would be my index?

Best!

Felipe

Ответить
@HarpreetKaurDhanoa
@HarpreetKaurDhanoa - 19.07.2021 15:28

Do we need to check the assumptions like multicolliarity..autocorrelation etc before selecting model of regression or we should select model first either it is fixed effect or random effect?

Ответить
@stephenogbodo1328
@stephenogbodo1328 - 15.07.2021 11:29

Succinct and very helpful. Thank you very much :)

Ответить
@lukewilson5567
@lukewilson5567 - 12.07.2021 15:03

Thank you! One question: Can I also run the within model if my dependent variable is a dummy?

Ответить
@juanpabloalfonsosanchez3385
@juanpabloalfonsosanchez3385 - 07.05.2021 17:22

appreciated man!

Ответить
@impieman10
@impieman10 - 05.05.2021 10:40

Hello Sebastian, this video was very helpful for understanding the plm package and the "within" model. I need to use this model on a particularly huge dataset. I let the code running for hours, but it won't finish, so I don't know if maybe I am just using the code incorrectly.

I suspect that it is because there are lots of na's in my data. Do you have any tips to help the plm function run faster?

the code I am using is:

reg_Y = plm(Y ~ Zt + as.factor(year), data= DF, index = "id", model = "within", na.action = na.omit)

Where DF is 10 million observations of 17 variables. There are 8 years in total. Some of these observations are the log-differences, some are lags and some are leads. So they leave na's in different places.

Ответить
@Mohammed-yl5wr
@Mohammed-yl5wr - 04.05.2021 02:40

I am trying to simulate data for the fixed effect model. I am struggling in generating the time-invariant & subject-invariant effect since they are must be correlated with X. Is there a reference on how to simulate these 2 effects?

Ответить
@nickvantreuren333
@nickvantreuren333 - 25.04.2021 17:03

Thank you very much for this clear explanation!

Ответить
@ShreyasMeher
@ShreyasMeher - 08.04.2021 18:51

This is excellent. I'd love to get even more videos like these on complete panel data exploration and other tests that we can run on such data. Thank you for the video and your work!

Ответить
@DevilishDealer
@DevilishDealer - 26.03.2021 01:21

You're the GOAT

Ответить
@pablohernandezgomez531
@pablohernandezgomez531 - 08.03.2021 23:42

Hello Sebastian. I have a data in which I regress net income of firms which are members of a business group on control variables and net working capital and ultimate owner of the business group ( firm, family or government). If I need to see the interaction between NWC and every type of owner I'd do NWC*type of owner, however, there will always be a type of interaction, the reference one, that won't be seen. I can't just look at the intercept because one of the regressors is type of owner (different to the one with the interaction). How could I solve this situation?

Ответить
@kevinciocco5876
@kevinciocco5876 - 23.02.2021 03:10

I'm using fixed effects for years 2010-2019, but for some reason only 2016-2019 are taken as factors. Any idea why this might be happening? Thanks.

Ответить
@marcopozzan445
@marcopozzan445 - 25.11.2020 22:09

Thank you for the video! How do I apply industry, country and week fixed effects in the same regression?

Ответить
@fabior3199
@fabior3199 - 18.11.2020 18:39

Thank you, you just saved my B.A.! Do you know if there is a way to exclude the factor variables from the regression output to clean it up for a paper?

Ответить
@raisulalam6051
@raisulalam6051 - 05.11.2020 20:06

Thanks

Ответить
@juliedelacour4133
@juliedelacour4133 - 27.08.2020 15:12

Hi, in the within estimator - how can you see what effect the state has now that it can't be seen in the output?

Ответить
@divineknowledgeable
@divineknowledgeable - 20.08.2020 19:05

after adding the legal variable. the intercept was missing. how do you recover the intercept. i'm having same problem and every r-code i use doest reveal the y-intercept

Ответить
@tomoomen3952
@tomoomen3952 - 19.07.2020 16:52

Thank you for the awesome explenation, very clear!

Ответить
@asoabdullah9507
@asoabdullah9507 - 29.06.2020 02:03

Dear Professor, do you work privately?

Ответить
@azera8086
@azera8086 - 01.05.2020 21:47

Hello Sebastian, I have a dataset of IPO offerings over time (let's say 15 years). Due to its nature (one company may go public only once), every company exists only once in a dataset and there might be uneven number of observations across years. Can I treat my dataset as panel data and apply fixed effects? Or should I treat is rather as a cross-section? If the latter is the case, can I apply fixed effects on years? I know there might be significant differences across years and I would like to control for them. Thanks a lot for your answer!

Ответить
@kamrulhassan7157
@kamrulhassan7157 - 08.04.2020 23:15

Thanks sir for the nice video . Is there any good and updated book for learning econometrics in R ?

Ответить