R-users
E-mail: r-help@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.

-- 
*****    [EMAIL PROTECTED]    *****
http://cse.naro.affrc.go.jp/takezawa/intro.html

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to