Questions tagged [plm]

R package primarily concerned with panel data. Package contains a set of estimators and tests for panel data.

510 questions
0
votes
1 answer

R: Are there any known issues when plyr/dplyr/data.table and plm packages used together

I have been forming a panel dataset based on many other panel datasets. I have been puzzled by data.table or even base R function merge() that often alter the ordering of rows. So after much trial and error I used the following from plyr: join(x, y,…
Polar Bear
  • 731
  • 1
  • 7
  • 21
0
votes
2 answers

Trying to loop through "plm" objects in R and replace coefficients (atomic vector, non-language)

Note: I've super new to R (just transitioning from Stata)! Hi guys! I have a large number of "plm" objects numbered as plm_f_1_1, plm_f_1_2,..., plm_f_1_17, plm_f_2_1,... and so on, and I have data frames of coefficients stored, let's say in…
Nafis S.
  • 303
  • 1
  • 2
  • 10
0
votes
0 answers

Error: crossprod(t(X), beta) in panel study

I am working on a panel study project (in R) and encountered the following error(s) when creating a within fixed effect: within5 <- plm(Y~X1*X3+X8+X9, data=pdata2, model = "within") summary(within5) Here X8 and X9 are control variables (but they…
Dennis
  • 9
  • 3
0
votes
1 answer

R: can I tell plm which variables to use the within transformation on?

I have a dataset where I want to group countries on a broader level then per country. Still, the country is the id variable in my dataset. Example: library(plm) Data <- data.frame(iris) Data$time <- c(rep(1951:2000,3)) Data$mygroup <-…
Jakob
  • 1,325
  • 15
  • 31
0
votes
0 answers

R:Implementing variable selection in panel data model

I am doing panel data analysis with 17 variables in R using the package "plm". I have to eliminate these variables while retaining the most significant of them. I am looking at adjusted R-square for the set of variables that best explain my…
Polar Bear
  • 731
  • 1
  • 7
  • 21
0
votes
1 answer

Plot Effects of Variables in Interaction Terms

I would like to plot the effects of variables in interaction terms, using panel data and a FE model. I have various interaction effects in my equation, for example this one here: FIXED1 <- plm(GDPPCgrowth ~ FDI * PRIVCR, data = dfp) I can only find…
Lisa
  • 1
  • 1
0
votes
2 answers

R how to pass a function to a function

When I want to specify my own robust standard errors in a regression command like plm, how do I do this directly without running several functions? library("plm") library("lmtest") Data <- iris Data$time <- as.numeric(rep(1951:2000,3)) here is what…
Jakob
  • 1,325
  • 15
  • 31
0
votes
1 answer

How to add lag to random effects model using plm package

I have a random effects model in which I model housing prices. Now I'd like to add a lag to the model using the plm package, however I don't know ho to do so. I coded my regression as follows: randomHUIS = plm(YHUIS ~ XHUIS, data = panel, index =…
stuvu
  • 11
0
votes
2 answers

R: How to calculate year-wise mean and other operations on daily data for elements in a column

Please help me out. I have been stuck for a long time. I am an R beginner, and I want to know how to perform operations on data frame elements using multiple indices e.g. firms and time as in the below case elegantly? I want to perform some typical…
Polar Bear
  • 731
  • 1
  • 7
  • 21
0
votes
0 answers

How does the plm package in R deal with unbalanced panel data with singletons?

I'm using plm package to analyze unbalanced panel data. The problem is that some firms in the sample have only one year observation. This caused a problem whenever I use the following function (the purpose is to calculate white standard…
Gödel
  • 592
  • 4
  • 21
0
votes
1 answer

How to find significant coefficients

I can get significant coefficients while using the summary command. Here I see that Sepal.Width and Petal.Length have alot lower P values by looking at the stars. However these stars disappear if I only print out the coefficients. How do I get the…
Bobe Kryant
  • 2,050
  • 4
  • 19
  • 32
0
votes
0 answers

“length of 'dimnames' [2] not equal to array extent”

So I have seen questions regarding this error code before, but the suggested troubleshooting that worked for those authors didn't help me diagnose. I'm self-learning R and new to Stackoverflow, so please give me constructive feedback on how to…
Tony
  • 11
  • 3
0
votes
1 answer

Clustered robust standard errors on country-year pairs

I want to replicate a Stata do.file (panel model) in R, but unfortunately I'm ending up with the wrong standard error estimates. The data is proprietary, so I can't post it here. The Stata code used looks like: xtreg Y X, vce(cluster…
Justus_89
  • 1
  • 1
0
votes
0 answers

Combining Effects and PLM package when using factor variables.

I am trying to use the effects package to extract predicted values for a PLM Model. Unfortunately, as soon as I include a factor variable, the effects package breaks down with the error message Error in Summary.factor(c(2L, 1L, 1L, 2L, 1L, 2L, 1L,…
CGN
  • 687
  • 1
  • 6
  • 12
0
votes
1 answer

R: pwfdtest produces an error message even with the test data

In R using the plm package, pwfdtest produces an error message even with the test data: pwfdtest(log(emp) ~ log(wage) + log(capital), data = EmplUK, h0 = "fe") Error message: "Error in order(nchar(cnames), decreasing = TRUE) : 4 arguments …