You are not offering example of real codings but are rather showing
something1 that you think looks like something2 (in R) that looks like
something3 (in a textbook?). My guess is that the something2 might be
contrast matrices or model matrices.
If you want a contrast matrix whose columns sum to zero (which is one
possible situation that some people might call "centered" then look at
the documentation for sum and poly contrasts. If you want to see a
situation where model matrices are constructed which compare to the
overall mean (another possible interpretation of "centered"), then
look at the documentation for model.matrix and run the examples on
that page with a -1 in the formula.
--
David.
On Jan 11, 2011, at 3:18 PM, Christofer Bogaso wrote:
Dear all, I would like to ask one question related to statistics, for
specifically on defining dummy variables. As of now, I have come
across 3
different kind of dummy variables (assuming I am working with Seasonal
dummy, and number of season is 4):
dummy1 <- diag(4)
for(i in 1:3) dummy1 <- rbind(dummy1, diag(4))
dummy1 <- dummy1[,-4]
dummy2 <- dummy1
dummy2[dummy2 == 0] = -1/(4-1)
dummy3 <- dummy1 - 1/4
head(dummy1)
[,1] [,2] [,3]
[1,] 1 0 0
[2,] 0 1 0
[3,] 0 0 1
[4,] 0 0 0
[5,] 1 0 0
[6,] 0 1 0
head(dummy2)
[,1] [,2] [,3]
[1,] 1.0000000 -0.3333333 -0.3333333
[2,] -0.3333333 1.0000000 -0.3333333
[3,] -0.3333333 -0.3333333 1.0000000
[4,] -0.3333333 -0.3333333 -0.3333333
[5,] 1.0000000 -0.3333333 -0.3333333
[6,] -0.3333333 1.0000000 -0.3333333
head(dummy3)
[,1] [,2] [,3]
[1,] 0.75 -0.25 -0.25
[2,] -0.25 0.75 -0.25
[3,] -0.25 -0.25 0.75
[4,] -0.25 -0.25 -0.25
[5,] 0.75 -0.25 -0.25
[6,] -0.25 0.75 -0.25
Now I want to know which type of dummy definition is called Centered
dummy
and why it is called so? Is it equivalent to use any of the above
definitions (atleast 2nd and 3rd?) It would really be very helpful if
somebody point any suggestion and clarification.
Thanks and regards,
[[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.
David Winsemius, MD
West Hartford, CT
______________________________________________
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.