Watts-College / cpp-525-spr-2022

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

Lab 3 Clarifications #7

Closed jmacost5 closed 2 years ago

jmacost5 commented 2 years ago

Hello Everyone, I am working on the lab for this week and was getting errors with what I thought would be the correct variables for each of the functions. Q2c:

S <-data$State
fixed_reg = lm ( y ~ x + as.factor(S), data = data)

stargazer( Pooled_OLS, fixed_reg,
           type = "html", 
           dep.var.labels = c("Mortality Rates", 
                              ),
           column.labels = c("Pooled OLS",
                             "Fixed effect"),
           covariate.labels = c("Beer Taxes - Year 1", 
                                "Beer Taxes", 
                                "State B", "State C"),
           omit.stat = "all", 
           digits = 2, intercept.bottom = FALSE )

Error in model.frame.default(formula = y ~ x + as.factor(S), data = data, : variable lengths differ (found for 'as.factor(S)') My logic with this one is that I thought it would be the S or Y variable.