Stack Overflow Asked by Ronie Febriansah on November 7, 2021
I have a problem when I want to do the lmtest using whitetest.
Anyone might be able to help to solve the problem
script:
library(lmtest)
data = read.csv("D:/polidoor.csv", header = T, sep = ",")
white.test(x,y)
result:
library(lmtest)
data = read.csv("D:/polidoor.csv", header = T, sep = ",")
white.test(x,y)
Error in white.test(x, y) : object ‘x’ not found
You can use with
with(data,
white.test(x,y)
)
Assuming x
and y
are columns of data
.
Answered by Edward on November 7, 2021
You haven't defined x
(or y
) which you are inputting to the test function.
x
needs to be a a "numeric vector, matrix, or time series", and y
needs to be a numeric vector according to this.
I'm assuming you want to use your data that you imported. This does not automatically put things in the x
and y
variable. You need to select columns using dataframe notation.
For example, if you want your first column to be input feature column, and the second to be the output, you can use
x <- data[, 1]
y <- data[, 2]
Answered by Marcel on November 7, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP