Error in lm.fit(X, y) : 0 (non-NA) cases for white test

I'm trying to do a white test for my model, but I cannot understand why this error happens, I do not there any x or y is NA.

lm_birthweight_2 = lm(birthweight~smoker+nprevist, data = x)
bptest(lm_birthweight_2, ~ smoker*nprevist + I(smoker^2) + I(nprevist^2), data = x)

Error in lm.fit(X, y) : 0 (non-NA) cases

Hello.
Thanks for providing code , but you could take further steps to make it more convenient for other forum users to help you.

Share some representative data that will enable your code to run and show the problematic behaviour.

You might use tools such as the library datapasta, or the base function dput() to share a portion of data in code form, i.e. that can be copied from forum and pasted to R session.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.