Hello,

I am trying to get the 'rank' function to work for me, but not sure what I
am doing wrong.  Please help.

I ran the following commands:

data = read.table("test1.csv", head=T, as.is=T, na.string=".", row.nam=NULL)
X1 = as.factor(data[[3]])
X2 = as.factor(data[[4]])
X3 = as.factor(data[[5]])
Y = data[[2]]
model = lm(Y ~ X1*X2*X3, na.action = na.exclude)
fmodel = fitted(model)
fmodel
(First line is shown below.....)


       1        2        3        4        5        6        7        8
   9       10       11       12       13       14       15       16
17
180.3763 180.3763 180.3763 180.3763 180.4546 180.3763 177.9245 177.9245
181.3859 180.3763       NA 180.4546 180.3763 180.4546 180.3763 180.3763
180.4546

Then I run:
fmodel.rank = rank(fmodel)
fmodel.rank
(First line is shown below....)

    1     2     3     4     5     6     7     8     9    10    11    12
 13    14    15    16    17    18    19    20    21    22    23    24    25
   26
375.0 222.0  68.5  68.5 402.5 222.0  33.5  33.5 465.5 222.0 500.0 402.5
222.0 402.5 222.0 222.0 378.5 222.0 222.0 222.0 222.0 222.0 402.5 222.0
 33.5 222.0


As you can see, first 4 values of 'fmodel' are 180.3763, so after running
rank(fmodel) I expected the ranks of first 4 to be the same, but they are
not.  What am I doing wrong?  Please let me know.  Thanks.

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