G'day Stephen,

On Wed, 7 Jul 2010 16:41:18 -0400
"Bond, Stephen" <stephen.b...@cibc.com> wrote:

> Please, do not post if you do not know the answer. People will see
> this has answers and skip.
> 
> I tried with 
> mat1=contrasts(fixw$snconv)
> mat1=mat1[,-2]
> summary(frm2sum <- glm(resp.frm ~
> C(snconv,contr=mat1)+mprime+mshape,data=fixw,family="quasibinomial"))
> 
> the unwanted level is still there. Unbelievable.

model.matrix() instead of summary() would reveal that the estimate
corresponding to "the unwanted level" is probably estimating something
quite different then what you think it estimates.

?C and look at the how.many argument, presumably you want 
            C(snconv, contr=mat1, how.many=NCOL(mat1))

To see what is going on, consider:

R> ( tmp <- gl(4,3) )
 [1] 1 1 1 2 2 2 3 3 3 4 4 4
Levels: 1 2 3 4
R> options(contrasts=c("contr.sum", "contr.poly"))
R> ( tt <- contrasts(tmp) )
  [,1] [,2] [,3]
1    1    0    0
2    0    1    0
3    0    0    1
4   -1   -1   -1
R> tt <- tt[,-2]
R> contrasts(tmp, 2) <- tt
R> tmp
 [1] 1 1 1 2 2 2 3 3 3 4 4 4
attr(,"contrasts")
  [,1] [,2]
1    1    0
2    0    0
3    0    1
4   -1   -1
Levels: 1 2 3 4
R> contrasts(tmp) <- tt
R> tmp
 [1] 1 1 1 2 2 2 3 3 3 4 4 4
attr(,"contrasts")
  [,1] [,2]       [,3]
1    1    0  0.2886751
2    0    0 -0.8660254
3    0    1  0.2886751
4   -1   -1  0.2886751
Levels: 1 2 3 4

HTH.

Cheers,

        Berwin

========================== Full address ============================
Berwin A Turlach                      Tel.: +61 (8) 6488 3338 (secr)
School of Maths and Stats (M019)            +61 (8) 6488 3383 (self)
The University of Western Australia   FAX : +61 (8) 6488 1028
35 Stirling Highway                   
Crawley WA 6009                e-mail: ber...@maths.uwa.edu.au
Australia                        http://www.maths.uwa.edu.au/~berwin

______________________________________________
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