Error in is.pbalanced.default(x) : argument "y" is missing, with no default

I would like to run a random effect model.

Y <- cbind(mydata$NIFTY_50)
X <- cbind(mydata$STI,mydata$HIS,mydata$NASDAQ_composite,mydata$FTSE_100,mydata$Nikkei_225)
X1 <- cbind(mydata$COVID_new_cases)

pdata <- plm.data(mydata, index=c("COVID_new_cases","NASDAQ_composite"))
random <- plm(Y ~ X, data=pdata, model= "random")
summary(random)

I am getting this error

random <- plm(Y ~ X, data=pdata, model= "random")
Error in is.pbalanced.default(x) :
argument "y" is missing, with no default
summary(random)
Error in h(simpleError(msg, call)) :
error in evaluating the argument 'object' in selecting a method for function 'summary': object 'random' not found

Thanks in advance.

Date COVID_new_cases NIFTY_50 STI HSI NASDAQ_composite S&P_100 FTSE_100 Nikkei_225
31-Dec-19 54 -0.642 -0.672 -0.183 -0.604 -0.495 -0.589 0.481
01-Jan-20 0 -0.161 -0.672 -0.183 -0.604 -0.495 -0.589 0.481
02-Jan-20 0 0.686 -0.666 1.041 -0.583 -0.666 0.821 0.481
03-Jan-20 34 -0.281 0.658 -1.307 -0.494 -0.225 0.238 0.481
06-Jan-20 0 -1.459 0.084 -0.354 -1.431 -1.046 -0.618 0.493
07-Jan-20 0 -0.216 -0.359 -0.108 0.089 0.247 -0.018 -1.096
08-Jan-20 0 0.722 -1.078 0.316 -0.675 -0.55 0.013 0.055
09-Jan-20 0 0.516 0.467 0.682 -0.013 -0.296 0.306 -0.891
10-Jan-20 0 -0.116 -0.101 -0.094 0.586 0.527 -0.134 -0.157
13-Jan-20 2 0.267 0.257 0.635 -0.653 -0.538 0.391 -0.157
14-Jan-20 0 0.237 -0.259 -0.907 0.208 0.173 0.063 -0.234
15-Jan-20 2 -0.049 0.293 -0.407 -0.053 -0.184 0.268 0.029
16-Jan-20 0 0.068 -0.65 0.267 -0.469 -0.334 -0.432 0.113
17-Jan-20 10 0.194 0.055 0.235 0.037 -0.159 0.852 0.258
20-Jan-20 40 -1.657 0.026 -1.279 0.037 -0.159 -0.302 -0.012
21-Jan-20 306 -0.209 0.746 -1.631 -0.104 0.024 -0.532 0.865
22-Jan-20 284 -0.912 -0.349 0.799 0.317 0.203 -0.51 -0.822
23-Jan-20 194 0.467 0.531 -0.714 -0.264 -0.164 -0.848 0.202
24-Jan-20 532 0.605 -0.144 0.051 1.39 1.116 1.043 0.096
27-Jan-20 1594 -0.64 -0.144 0.051 -0.515 -0.034 -2.292 0.36
28-Jan-20 3534 -0.76 -0.269 0.051 -0.737 -0.645 0.926 -0.384
29-Jan-20 2960 0.121 -0.043 0.218 0.463 0.446 0.039 -0.301
30-Jan-20 3512 -0.922 0.393 -2.151 -0.953 -0.8 -1.358 1.318
31-Jan-20 4006 -1.143 0.62 -1.663 1.443 1.822 -1.3 -0.243
01-Feb-20 4240 -2.321 0.62 -1.663 1.443 1.822 -1.3 -0.243
03-Feb-20 5636 0.692 0.47 0.639 -0.9 -0.456 0.553 -0.427
04-Feb-20 6486 1.641 -0.672 0.696 -0.74 -0.514 1.549 -0.889
05-Feb-20 7814 0.694 -1.152 -0.307 0.683 -0.232 0.574 0.137
06-Feb-20 7502 0.148 -0.503 1.175 -0.327 -0.225 0.298 -0.983
07-Feb-20 6436 -0.435 1.017 0.175 0.064 0.103 -0.508 0.297
10-Feb-20 5976 -0.585 -0.658 0.551 -1.419 -1.165 -0.265 -0.229
11-Feb-20 5130 -0.004 -0.234 0.253 0.433 0.518 0.705 -0.229
12-Feb-20 4144 0.413 -1.288 0.384 -0.386 -0.243 0.467 -0.505
13-Feb-20 30302 -0.367 0.315 -0.8 -0.569 -0.162 -1.094 0.092
14-Feb-20 8430 -0.629 -0.114 0.423 -0.023 -0.022 -0.576 0.114
17-Feb-20 4134 -0.709 0.238 0.695 -0.023 -0.022 0.327 -0.142
18-Feb-20 3990 -0.297 0.211 -0.851 -0.555 -0.089 -0.69 0.875
19-Feb-20 3728 0.292 -0.453 0.616 -0.351 -0.218 1.016 -0.306
20-Feb-20 1064 -0.315 0.586 -0.569 0.492 0.357 -0.274 0.792
24-Feb-20 1054 -1.525 0.552 -1.049 -0.357 0.817 -3.337 0.175
25-Feb-20 1586 -0.67 -0.421 0.639 3.608 3.322 -1.941 1.499
26-Feb-20 1730 -0.512 0.451 0 0.342 0.498 0.351 -0.233
27-Feb-20 2218 -0.24 -0.047 0.94 2.031 2.711 -3.494 1.382
28-Feb-20 2538 -1.584 1.071 -0.454 -3.599 -1.77 -3.175 1.743
02-Mar-20 4188 -2.236 -0.648 0.82 -3.289 -4.001 1.129 -2.371
03-Mar-20 3672 0.764 0.422 -0.508 3.134 3.401 0.951 2.629
04-Mar-20 4560 -0.884 -0.326 -0.378 -2.083 -2.64 1.45 -0.971
05-Mar-20 4630 -0.328 0.619 1.593 0.586 1.556 -1.617 0.331
06-Mar-20 6066 0.428 1.275 -0.951 -1.259 -1.069 -3.621 1.238
09-Mar-20 8358 -2.705 3.777 -0.372 0.091 3.121 -7.687 3.168
11-Mar-20 9980 1.201 -2.399 -0.897 2.264 2.95 -1.404 1.732
12-Mar-20 15324 -4.48 2.654 -1.414 2.66 4.968 -10.874 2.648
13-Mar-20 18372 9.307 2.654 6.721 -3.475 -5.754 2.455 4.138
16-Mar-20 24794 -4.072 2.425 -1.09 6.603 2.842 -4.007 3.321
17-Mar-20 27842 -3.429 0.615 1.139 -3.716 -4.043 2.792 -1.701
18-Mar-20 33448 -6.818 1.897 -3.177 -1.268 0.083 -4.047 2.492
19-Mar-20 40240 2.482 4.321 -2.305 -2.203 -0.388 1.397 2.606
20-Mar-20 61454 5.565 -4.146 2.97 5.085 5.34 0.761 2.606
23-Mar-20 67790 -4.222 1.798 0 -0.196 1.915 -3.793 -1.914
24-Mar-20 87762 -0.602 -3.031 0.738 -3.081 -3.633 9.053 -5.146
25-Mar-20 83110 7.533 -3.124 1.166 0.499 0.109 4.447 -5.962
26-Mar-20 105490 2.254 1.26 -1.07 -4.494 -5.039 2.241 2.964
27-Mar-20 120924 -3.228 0.663 -1.195 0.687 0.874 -5.251 -1.932
30-Mar-20 113786 -1.25 2.57 0.67 -2.515 -2.806 0.969 -1.064
31-Mar-20 128262 0.802 -1.103 -0.041 0.516 1.069 1.947 1.381
01-Apr-20 146810 -3.848 1.13 -1.199 1.326 0.632 -3.833 3.322
03-Apr-20 153326 -3.264 -2.106 0.707 1.393 0.984 -1.181 0.731
07-Apr-20 146458 4.095 2.536 0.665 2.986 2.979 2.187 -0.378
08-Apr-20 150672 0.689 -1.688 -0.913 -1.444 -1.921 -0.47 -1.604
09-Apr-20 170030 1.547 -2.619 0.492 0.189 -0.092 2.906 0.156
13-Apr-20 140242 -1.209 -0.44 0.361 -0.796 0.232 -0.88 1.391
15-Apr-20 155234 -2.948 -0.228 -1.447 -0.445 0.293 -3.343 -2.551
16-Apr-20 157792 1.599 -2.483 -0.079 -0.628 -0.074 0.548 0.109
17-Apr-20 166738 -0.608 1.562 -0.318 0.2 -0.875 2.818 -1.642
20-Apr-20 142550 -1.367 -1.193 -0.708 -0.086 0.796 0.446 0.105
21-Apr-20 151336 -0.394 1.754 -1.874 2.334 2.005 -2.956 1.022
22-Apr-20 171992 1.779 0.946 1.499 -0.721 -0.404 2.297 -0.151
23-Apr-20 132212 0.883 1.546 -0.026 0.4 0.403 0.97 -0.603
24-Apr-20 154934 -0.104 -0.753 -0.055 -1.224 -0.926 -1.277 0.361
27-Apr-20 164906 0.244 0.294 1.038 -0.14 -0.458 1.645 -1.918
28-Apr-20 131966 -0.095 0.469 0.717 2.469 1.764 1.91 0.025
29-Apr-20 142980 1.538 -0.942 -0.575 -1.272 -0.73 2.632 0.025
30-Apr-20 155602 1.091 -0.12 -0.575 0.241 0.437 -3.501 -0.438
04-May-20 156486 -2.517 -0.533 -1.177 -1.816 -0.891 -0.161 1.864
05-May-20 154948 -2.373 -0.932 0.475 0.006 0.105 1.662 1.864
06-May-20 158956 0.478 -0.314 0 0.229 0.907 0.075 1.864
07-May-20 180204 -0.379 -0.314 -0.581 -0.066 0.029 1.404 -1.059
08-May-20 187946 -1.338 0.261 0.152 -0.711 -0.679 1.404 -1.036
11-May-20 153282 -1.165 -0.971 0.539 -1.518 -0.606 0.062 -0.28
12-May-20 142190 0.302 0.327 -0.461 2.413 2.195 0.928 0.229
13-May-20 171682 -2.094 -0.518 0.285 1.586 1.453 -1.513 -0.626
14-May-20 172148 -0.773 -0.204 -0.867 -1.771 -1.921 -2.754 1.121
15-May-20 193292 -0.496 0.066 -0.156 -1.975 -1.265 1.015 0.557
18-May-20 162006 -3.658 0.955 0.835 -0.629 -1.229 4.29 -0.18
19-May-20 174334 -0.922 0.491 -0.414 0.459 0.867 -0.767 0.176
20-May-20 190188 1.996 -0.487 -0.257 -0.754 -0.672 1.083 -0.688
21-May-20 199132 0.295 0.086 -1.015 0.963 0.819 -0.855 0.678
22-May-20 215460 -0.316 0.83 -3.48 -0.496 -0.257 -0.366 0.951
26-May-20 178302 -0.777 0.937 0.803 1.694 0.606 1.243 -1.64
27-May-20 191932 2.563 1.311 -0.909 -0.709 -0.698 1.261 -0.8
28-May-20 205238 1.336 -0.515 -0.319 0.256 0.454 1.213 -1.404
29-May-20 237424 1.678 0.311 0.792 -1.146 -0.548 -2.287 -0.322

in R in general, formula's passed into model fitting functions should relate to variable names present in training data.frames .
It seems to me that neither a variable Y not a variable X appears in your data. What model are you trying to fit ? a model between covid cases and nasdaq stock index ? then these variables would be in the formula

these are dependent and independent variables

Y <- cbind(mydata$NIFTY_50)
X <-cbind(mydata$STI,mydata$HIS,mydata$NASDAQ_composite,mydata$FTSE_100,mydata$Nikkei_225)
X1 <- cbind(mydata$COVID_new_cases)

I think that Cbinding is getting you into trouble
doesnt this work ?

pdata <- plm.data(mydata, index=c("COVID_new_cases","NASDAQ_composite"))
random <- plm(NIFTY_50 ~ STI + HIS+ NASDAQ_composite + FTSE_100 + Nikkei_225, 
               data=pdata, model= "random")
1 Like

Thanks a lot. The error was due to cbinding. I removed the cbinding and model worked.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.