Explore Courses Blog Tutorials Interview Questions
0 votes
in R Programming by (50.2k points)

In the RStudio, I want to perform OLS regression but I don't understand why the following code does not work. 

wage <- read.csv("wage21.csv")

earnings <- wage$EARNINGS    

S <- wage$S    

model1 <- lm(earnings  ̃ 1+S) 

It responds with an error:

Error in parse(text = x, srcfile = src): <text>:6:24: unexpected input


6: model1 <- lm(earnings  <cc>



1 Answer

0 votes
by (108k points)

The correct way of performing the OLS regression is:

fit1 <- lm(EARNINGS ~ 1+S, data = wage) 

If you are a  beginner and want to know more about R then do check out the R programming course

Browse Categories