Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- > data.frame(y = c(332928,358323,422244,430035,3168,2397,3099,5508,23802,26346,28546,33933,2286,2370,5667,9468,6024,5370,6126,7971,5979,4893,5007,6381,17985,18771,24081,26532),t=rep(c(1996,2001,2006,2013),7),type=rep(c("car","mb","bus","train","other","bike","walk"),each=4)) -> dat
- >
- > dat$t96 <- dat$t-1996
- > dat$type <- relevel(dat$type, "car")
- >
- > model <- lm(log(y) ~ t96*type, data=dat)
- > summary(model)
- Call:
- lm(formula = log(y) ~ t96 * type, data = dat)
- Residuals:
- Min 1Q Median 3Q Max
- -0.279909 -0.063599 0.003915 0.076055 0.229129
- Coefficients:
- Estimate Std. Error t value Pr(>|t|)
- (Intercept) 12.727926 0.130850 97.271 < 2e-16 ***
- t96 0.016191 0.012862 1.259 0.228661
- typebike -4.152250 0.185049 -22.439 2.25e-12 ***
- typebus -2.655501 0.185049 -14.350 9.13e-10 ***
- typemb -4.896199 0.185049 -26.459 2.35e-13 ***
- typeother -4.125717 0.185049 -22.295 2.45e-12 ***
- typetrain -5.136153 0.185049 -27.756 1.22e-13 ***
- typewalk -2.950006 0.185049 -15.942 2.27e-10 ***
- t96:typebike -0.010925 0.018189 -0.601 0.557700
- t96:typebus 0.004381 0.018189 0.241 0.813167
- t96:typemb 0.020331 0.018189 1.118 0.282497
- t96:typeother 0.002156 0.018189 0.119 0.907337
- t96:typetrain 0.075565 0.018189 4.154 0.000973 ***
- t96:typewalk 0.008839 0.018189 0.486 0.634536
- ---
- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
- Residual standard error: 0.1617 on 14 degrees of freedom
- Multiple R-squared: 0.9947, Adjusted R-squared: 0.9897
- F-statistic: 201.2 on 13 and 14 DF, p-value: 1.395e-13
- > anova(model)
- Analysis of Variance Table
- Response: log(y)
- Df Sum Sq Mean Sq F value Pr(>F)
- t96 1 1.031 1.0307 39.432 2.024e-05 ***
- type 6 66.549 11.0915 424.356 5.214e-15 ***
- t96:type 6 0.775 0.1292 4.943 0.006513 **
- Residuals 14 0.366 0.0261
- ---
- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement