0

I am trying to run a linear regression and I need to remove one row of data. I am using the dataset Income Democracy.dta and I'm trying to remove the Azerbaijan row for a country fixed effects regression. I've played around with the subset and c() functions but nothing I'm trying is working. For reference this is how I did it keeping Azerbaijan in:

regfe = plm(dem_ind ~ log_gdppc, data = incdem[c("code", "year")])

I welcome any help, very new to R.

I have these packages loaded, however some of them are unrelated but I'm not sure what is needed:

library(tidyverse)
library(haven)
library(dplyr)
library(miceadds)
library(readr)
library(dplyr)
library(ggplot2)
library(estimatr)
library(Hmisc)
library(plm)

I think a comparable example would be running a fixed effects regression using the Grunfeld data set without one of the firms. e.g. without firm 6. I've tried something similar to grunex = subset(Grunfeld - grunfeld$firm == "6")

  • It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Please explicitly list all non-base R packages that you are using. What exactly did your attempt to use `subset=` look like? – MrFlick Oct 25 '21 at 03:25
  • I've had a look but I'm not an expert, do my edits help? – user17237061 Oct 25 '21 at 03:36

1 Answers1

1

Perhaps try:

incdem_subset <- incdem %>%
  filter(country != "Azerbaijan")

regfe = plm(dem_ind ~ log_gdppc, data = incdem_subset)
jared_mamrot
  • 22,354
  • 4
  • 21
  • 46