Hi,
I am using a data called Rail in the nlme package. The data contains two
variables: Rail and Travel.
>Rail
Grouped Data: travel ~ 1 | Rail
   Rail travel
1     1     55
2     1     53
3     1     54
4     2     26
5     2     37
6     2     32
7     3     78
8     3     91
9     3     85
10    4     92
11    4    100
12    4     96
13    5     49
14    5     51
15    5     50
16    6     80
17    6     85
18    6     83
>Rail$Rail
>[1] 1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6
>Levels: 2 < 5 < 1 < 6 < 3 < 4

Then I used the contrasts function as:
>contrasts(Rail$Rail)
And it returns with some strange continuous values:
             .L         .Q         .C         ^4          ^5
[1,] -0.5976143  0.5455447 -0.3726780  0.1889822 -0.06299408
[2,] -0.3585686 -0.1091089  0.5217492 -0.5669467  0.31497039
[3,] -0.1195229 -0.4364358  0.2981424  0.3779645 -0.62994079
[4,]  0.1195229 -0.4364358 -0.2981424  0.3779645  0.62994079
[5,]  0.3585686 -0.1091089 -0.5217492 -0.5669467 -0.31497039
[6,]  0.5976143  0.5455447  0.3726780  0.1889822  0.06299408

I am expecting to see 0s and 1s in the contrast, but it may be due to the
order of the factor levels for Rail variable?

Best,
Jing

        [[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