[R] Plm function, error in uniqval[as.character(effect), , drop = F]
lijuan huang
huanglijuan290441 at gmail.com
Mon Aug 29 18:10:38 CEST 2016
Hi, there,
I am trying to run a panel regression with a huge dataset, which has lots
of missing values. Here is some description of all variables.
> str(com3)
Classes ‘plm.dim’ and 'data.frame': 172153 obs. of 30 variables:
$ tic : Factor w/ 3435 levels "A","AA","AAC",..: 1 1 1 1 1
1 1 1 1 1 ...
$ idate : Factor w/ 81309 levels "2001/12/31 0:27",..: 34
2371 2450 4789 5977 7297 7650 9988 11288 12749 ...
$ IS_EFFECTIVE : int 1 1 1 1 1 1 1 1 1 1 ...
$ MATERIAL_WEAKNESS : int 0 0 0 0 0 0 0 0 0 0 ...
$ SIG_DEFICIENCY : int 0 0 0 0 0 0 0 0 0 0 ...
$ NOTEFF_ACC_RULE : int 0 0 0 0 0 0 0 0 0 0 ...
$ NOTEFF_FIN_FRAUD : int 0 0 0 0 0 0 0 0 0 0 ...
$ NOTEFF_OTHER : int 0 0 0 0 0 0 0 0 0 0 ...
$ IC_OP_TYPE_a1m0 : int NA NA NA NA NA NA NA NA NA NA ...
$ AUDITOR_FKEY : int NA NA NA NA NA NA NA NA NA NA ...
$ AUDITOR_AGREES : int NA NA NA NA NA NA NA NA NA NA ...
$ COMBINED_IC_OP : int NA NA NA NA NA NA NA NA NA NA ...
$ IC_IS_EFFECTIVE_Y1N0: Factor w/ 4 levels "","0","1","ND": NA NA NA NA NA
NA NA NA NA NA ...
$ AUDIT_FEES : int NA NA NA NA NA NA NA NA NA NA ...
$ NON_AUDIT_FEES : int NA NA NA NA NA NA NA NA NA NA ...
$ BENEFITS_FEES : int NA NA NA NA NA NA NA NA NA NA ...
$ IT_FEES : int NA NA NA NA NA NA NA NA NA NA ...
$ TAX_FEES : int NA NA NA NA NA NA NA NA NA NA ...
$ AUDIT_RELATED_FEES : int NA NA NA NA NA NA NA NA NA NA ...
$ OTHER_FEES : int NA NA NA NA NA NA NA NA NA NA ...
$ CARD : int NA NA NA NA NA NA NA NA NA NA ...
$ DISC : int NA NA NA NA NA NA NA NA NA NA ...
$ HACK : int NA NA NA NA NA NA NA NA NA NA ...
$ INSD : int NA NA NA NA NA NA NA NA NA NA ...
$ PHYS : int NA NA NA NA NA NA NA NA NA NA ...
$ PORT : int NA NA NA NA NA NA NA NA NA NA ...
$ STAT : int NA NA NA NA NA NA NA NA NA NA ...
$ UNKN : int NA NA NA NA NA NA NA NA NA NA ...
$ BRCH : int NA NA NA NA NA NA NA NA NA NA ...
$ ddate : Factor w/ 81306 levels "2001/12/31 0:27",..: 34
2371 2450 4789 5977 7297 7650 9988 11288 12749 ...
And I ran a panel regression as follow:
rm(list=ls())
library(plm)
como3 <- read.csv(file.path('como3.csv'),header = T, stringsAsFactors = F)
com3=plm.data(como3, indexes = NULL)
summary(com3)
Y <- cbind(com3$BRCH)
X <-
cbind(com3$IS_EFFECTIVE,com3$MATERIAL_WEAKNESS,com3$SIG_DEFICIENCY,com3$IC_IS_EFFECTIVE_Y1N0,com3$AUDITOR_AGREES,com3$COMBINED_IC_OP,com3$AUDIT_FEES)
fixed <- plm(Y ~ X,com3, index = c("tic","idate"),effect="individual",model
= "within")
summary(fixed)
Unfortunately, I got this error:
series IT_FEES, BRCH are constants and have been removedError in
uniqval[as.character(effect), , drop = F] :
incorrect number of dimensions
BRCH is my dependent variable, which is a dichotomous variable (happened
=1, unhappen=0). I don't know why it is considered as the "constant"? Does
it cause this error?
I have been looking for a solution in the internet for several days, but
have not found an answer to fix the problem.
Does anybody have an idea what I am doing wrong and what must be done to fix
the problem?
Thanks in advance.
Lynn Huang
[[alternative HTML version deleted]]
More information about the R-help
mailing list