Error in `*.default`(y, wts) : non-numeric argument to binary operator -> both are numeric?

19 Views Asked by At

getting error code Error in *.default(y, wts) : non-numeric argument to binary operator when running Bruesch Pagan test on R code,

both columns were already numerical, but tried using as.numeric() to convert both columns anyway, and testing with class() both are confirmed to be numerical, but the error still keeps repeating? Both arguments are numerical, so why would the binary operator not work? There are no empty, missing values, I have already removed them from the dataset I have also tried other tests, i.e. Durbin Watson, same issue

Convert values to numerical ones

CO2 emissions (metric tons per capita) <- as.numeric(CO2 emissions (metric tons per capita)) GDP per capita (current US$) <- as.numeric(GDP per capita (current US$))

#now model model <- dynlm(CO2 emissions (metric tons per capita)~GDP per capita (current US$), data = uk_data) summary(model) <- this works fine

bp_test <- bptest(model) This is where the issue comes in and I get that error class(CO2 emissions (metric tons per capita)) class(GDP per capita (current US$)) output for both is numeric

0

There are 0 best solutions below