duplicate 'row.names' are not allowed in Pgmm function in R (plm package)

Viewed 31

I have spent the last number of hours browsing and trying solutions for this problem, to no avail. I am essentially trying to regress Trading Volume on realised volatility using a GMM estimator, using Rstudios Pgmm function in the plm package.

library(plm)

# Data
f <- file.choose()
data <- read.csv(f)
data <- data.frame(data[,2:3])  # volume and volatility observations, one per day
View(data)

# Models
R_v <- pgmm(RV_adj ~ lag(RV_adj, 1) + lag(Vol_adj, 0:1) | lag(RV_adj, 2:99),
        data = data, effect = "twoways", model = "twosteps",
        transformation = "d")

However, no matter what I try, I get the error

"Error in .rowNamesDF<-(x, value = value) : duplicate 'row.names' are not allowed In addition: Warning message: non-unique values when setting 'row.names': ,"

The "row names," in my dataset are simply numbers 1:nrow(data), denoting the observation number (so they're not a weekday or anything).

Of course the row names/numbers are unique as they are observation numbers (of type "character,")

As I say I've attempted every solution I have found without luck, any help would be greatly appreciated

0 Answers
Related