0
votes

I want to identify the data points above a regression line. I have a panel data set which I have fit a fixed effects model:

data <- data.frame(ID = c(1,1,1,1,2,2,3,3,3),
                   year = c(1,2,3,4,1,2,1,2,3),
                   progenyMean = c(90,78,92,69,86,73,82,85,91),
                   damMean = c(89,89,72,98,95,92,94,87,89)

ID, year, progenyMean, damMean
1, 1, 70, 69
1, 2, 68, 69
1, 3, 72, 72
1, 4, 69, 68
2, 1, 76, 75
2, 2, 73, 80
3, 1, 72, 74
3, 2, 75, 67
3, 3, 71, 69

# Fixed Effects Model in plm
fixed <- plm(progenyMean ~ damMean, data, model= "within", index = c("ID","year"))

I have plotted progenyMean vs damMean with the fixed effects regression line: enter image description here

I want to identify the ID's above this regression line. I have computed the predicted values of the fixed effects model using the following code (based off code from this post)

fitted <- as.numeric(fixed$model[[1]] - fixed$residuals)
> fitted
 [1]  71.24338  79.03766  74.86613  71.34263  70.83020  71.56797  72.17324  74.54755  71.16720  73.37487
[11]  70.58863  69.27203  71.05852  59.72911  63.43947  68.69871  67.25271  75.68397  76.30475  81.12128

Is it possible to identify the ID's above the fixed effects regression line using the predicted values above and data.table in R?