[R] definition of "dffits"
Gabor Grothendieck
ggrothendieck at gmail.com
Sun Oct 19 14:17:24 CEST 2008
Check out:
http://en.wikipedia.org/wiki/DFFITS
On Sun, Oct 19, 2008 at 1:26 AM, Kunio takezawa <r.otasuke at gmail.com> wrote:
> R-users
> E-mail: r-help at r-project.org
>
> Hi! R-users.
>
> I am just wondering what the definition of "dffits" in R language is.
> Let me show you an simple example.
>
> function() {
> library(MASS)
>
> xx <- c(1,2,3,4,5)
> yy <- c(1,3,4,2,4)
>
> data1 <- data.frame(x=xx, y=yy)
> lm.out <- lm(y~., data=data1, x=T)
> lev1 <- lm.influence(lm.out)$hat
> sig1 <- lm.influence(lm.out)$sigma
> res1 <- residuals(lm.out)
>
> ey <- fitted(lm.out)
> py <- ey + res1/(1-lev1)
>
> df1 <- dffits(lm.out, infl = lm.influence(lm.out))
> df1 <- dffits(lm.out)
> print("df1: dffits")
> print(df1)
>
> my_df1 <- (ey-py)/(sig1*sqrt(lev1))
> print("my_df1")
> print(my_df1)
>
> my_df2 <- -lev1*(ey-py)/(sig1*sqrt(lev1))
>
> print("my_df2")
> print(my_df2)
> }
>
>
> [1] "df1: dffits"
> 1 2 3 4 5
> -1.3333333 0.4082483 0.6000000 -1.0475699 0.2672612
> [1] "my_df1"
> 1 2 3 4 5
> 2.2222222 -1.3608276 -3.0000000 3.4918995 -0.4454354
> [1] "my_df2"
> 1 2 3 4 5
> -1.3333333 0.4082483 0.6000000 -1.0475699 0.2672612
>
> I think that "my_df1" is "dffits"( http://en.wikipedia.org/wiki/DFFITS ),
> but in R language, "my_df2" gives the difinition of "dffits".
> Please let me know why.
>
> --
> ***** r.otasuke at gmail.com *****
> http://cse.naro.affrc.go.jp/takezawa/intro.html
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list