0

I'm running a multivariate regression in R with 5 separate OLS regressions in a single model.

set.seed(1)

SampleData <- data.frame(X = sample(1:10), X1 = sample(1:10), 
X2=sample(1:10), X3=sample(1:10), X4=sample(1:10), Y=sample(c("yes", "no"),
10, replace = TRUE))

OLS1 <- lm(X~X1, data=SampleData)
OLS2 <- lm(X~X1+X2, data=SampleData)
OLS3 <- lm(X~X1+X2+X3, data=SampleData)
OLS4 <- lm(X~X1+X2+X3+Y, data=SampleData)
OLS5 <- lm(X~X1+X2+X3+Y+X4, data=SampleData)

library(stargazer)
stargazer(OLS1, OLS2, OLS3, OLS4, OLS5, 
    type="text", omit="X4", omit.labels="X4 Omitted?")

For the last column (5) in the stargazer output, I include variable year and omit from model.

omit="year", 
omit.labels="Year Omitted?" 

However, each column of the "X4 Omitted?" row reads "No" in the model, while I want columns 1-4 to indicate "Yes" and column 5 to indicate "No":

enter image description here

I had thought omit.labels would identify this in the model and can't seem to find a formula to fix. Appreciate any help, thanks.

mysteRious
  • 4,102
  • 2
  • 16
  • 36
BeginneR
  • 1
  • 2
  • Welcome to SO. Could you provide us with a reproducable example so that we can look at it by recreating the situation on our systems? https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Jan Jun 20 '20 at 16:48
  • @Jan, thank you for the guidance. I created this sample set and had the same issue with omit.label: – BeginneR Jun 20 '20 at 17:04
  • @Jan, included edit in post above, thank you. – BeginneR Jun 20 '20 at 17:09

0 Answers0