Watts-College / cpp-525-spr-2022

https://watts-college.github.io/cpp-525-spr-2022/
0 stars 0 forks source link

LAB 03: OLS Issue #8

Open JPRayes opened 2 years ago

JPRayes commented 2 years ago

I keep getting this error when I enter this code:

OLS <- lm( y[data$accidents == 1] ~ x[data$taxes == 1], data = data)

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases

I've tried using other variable in the "lm" function and still get an error.

Dselby86 commented 2 years ago

You have to specify what y and x are in the data frame. Right now r is looking for a variable named y and x. Also if you use data$accidents == 1 then it will only give you the subset where accidents equals 1. Try state==1

On Fri, Apr 1, 2022, 6:36 AM JPRayes @.***> wrote:

I keep getting this error when I enter this code:

OLS <- lm( y[data$accidents == 1] ~ x[data$taxes == 1], data = data)

Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases

I've tried using other variable in the "lm" function and still get an error.

— Reply to this email directly, view it on GitHub https://github.com/Watts-College/cpp-525-spr-2022/issues/8, or unsubscribe https://github.com/notifications/unsubscribe-auth/AB4EHBYPLTMTI7O2WJPVCQLVC33XFANCNFSM5SIXD34Q . You are receiving this because you are subscribed to this thread.Message ID: @.***>