Hello,
I am trying to run a linear regression on my data
code in Rstudio
data_long$Field<-as.factor(data_long$Field)
data_long$Annual.Unemployment<-as.interger(data_long$Annual.Unemployment)
unempNPS.BASIC.lm <- lm(Values ~ Annual.Unemployment+Field=="Natural and Physical Sciences", data = data_long)
summ(unempNPS.BASIC.lm)
this is the sample dataset
|Field |Annual Unemployment |Values|
|Natural and Physical Sciences |6.15| |18085|
|Natural and Physical Sciences |5.98| |17750|
|Natural and Physical Sciences |6.4| |17965|
|Natural and Physical Sciences |5.75| |18220|
|Natural and Physical Sciences |5.35| |18120|
|Natural and Physical Sciences |5.35| |18150|
|Natural and Physical Sciences |5.1| |17895|
|Natural and Physical Sciences |4.73| |17385|
|Natural and Physical Sciences |4.28| |17700|
|Natural and Physical Sciences |4.05| |17595|
The Value~Annual.Unemployment excutes correctly but when i add the moderator Field=="Natural and Physical Sciences" i get an error "Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) : 0 (non-NA) cases"
Can anyone Help!