Download presentation
Presentation is loading. Please wait.
1
以每年參觀Lake Keepit的人數為例
數98級乙班 林柏佐
2
Variable Dist=Distance Inc=Family Income Size=Family Members
Y=Numbers of Vistors
3
pair
4
Residuals Plot-SLR
5
Box-Cox
6
Transformation fm1<-lm(log(Y+1)~Dist+Inc+Size)
在做轉換時,要注意各係數都必須是正數,因為Y有0,所以我讓其加1,來做regression
7
Residuals Plot-Transformation
8
Select Model fm2<-lm(log(Y+1)~Dist+Size) Coefficients:
Estimate Std. Error t value Pr(>|t|) (Intercept) < 2e-16 *** Dist < 2e-16 *** Size *** --- Signif. codes: 0 ‘***’ ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: on 247 degrees of freedom Multiple R-squared: , Adjusted R-squared: F-statistic: on 2 and 247 DF, p-value: < 2.2e-16
9
Residuals Plot-Select Model
10
Variance Stable Call: lm(formula = sqrt(Y) ~ Dist + Inc + Size)
Residuals: Min Q Median Q Max Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) < 2e-16 *** Dist < 2e-16 *** Inc Size *** --- Signif. codes: 0 ‘***’ ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: on 246 degrees of freedom Multiple R-squared: 0.424, Adjusted R-squared: 0.417 F-statistic: on 3 and 246 DF, p-value: < 2.2e-16
11
Residuals Plot-Variance Stable
12
WLS lm(formula = sqrt(Y) ~ Dist + Inc + Size, weights = wi) Residuals:
Min Q Median Q Max Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) < 2e-16 *** Dist < 2e-16 *** Inc #收入太低決定將其拿掉 Size *** --- Signif. codes: 0 ‘***’ ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: on 246 degrees of freedom Multiple R-squared: , Adjusted R-squared: F-statistic: on 3 and 246 DF, p-value: < 2.2e-16
13
Residuals Plot-WLS
14
WLS+Model Selection Call:
lm(formula = sqrt(Y) ~ Dist + Size, weights = wi) Residuals: Min Q Median Q Max Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) < 2e-16 *** Dist < 2e-16 *** Size *** --- Signif. codes: 0 ‘***’ ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: on 247 degrees of freedom Multiple R-squared: , Adjusted R-squared: F-statistic: on 2 and 247 DF, p-value: < 2.2e-16
15
Residuals Plot-WLS+Model Selcetion
16
結論 最後我選擇 這個model, 但是其實還是有很多要改進,它的R-squared太低,解釋力不夠。或許利用generalized least square可以解決這個問題。
17
Thanks for your attention.
The End Thanks for your attention.
Similar presentations