Displaying 1 result from an estimated 1 matches for "wdaytue".
Did you mean:
wdate
2024 May 09
2
Strange variable names in factor regression
...m(nrow(mydf.work), mean = 20, sd =
5))
mydf.weekend[, "volume"] <- round(rnorm(nrow(mydf.weekend), mean = 10,
sd = 5))
mydf <- rbind(mydf.work, mydf.weekend)
reg <- lm(volume ~ wday, data = mydf)
## Variable names as expected
coef(reg)
(Intercept) wdayMon wdaySat wdaySun wdayThu wdayTue
21.3846154 1.3076923 -12.0000000 -12.9230769 -1.9230769 -0.6923077
wdayWed
-1.6153846
reg <- lm(volume ~ wday - 1, data = mydf)
# Variable names as expected
coef(reg)
wdayFri wdayMon wdaySat wdaySun wdayThu wdayTue wdayWed
21.384615 22.692308 9.384615 8.461538 19.461538 20.692308 19.769231
# O...