Displaying 7 results from an estimated 7 matches for "mf3".
Did you mean:
mf
2019 Feb 21
2
model.matrix.default() silently ignores bad contrasts.arg
...by two wrong contrasts
> arguments, followed by a correct contrasts argument.
>
> data(cbpp, package="lme4")
> mf1 <- model.matrix(~period, data=cbpp)
> mf2 <- model.matrix(~period, contrasts.arg="contr.sum", data=cbpp)
> all.equal(mf1,mf2) ## TRUE
> mf3 <- model.matrix(~period, contrasts.arg=contr.sum, data=cbpp)
> all.equal(mf1,mf3) ## TRUE
> mf4 <- model.matrix(~period, contrasts.arg=list(period=contr.sum),
> data=cbpp)
> isTRUE(all.equal(mf1,mf4)) ## FALSE
>
>
> I've attached a potential patch for this, which...
2019 Feb 22
2
model.matrix.default() silently ignores bad contrasts.arg
...ent.
>> >
>> > data(cbpp, package="lme4")
>> > mf1 <- model.matrix(~period, data=cbpp)
>> > mf2 <- model.matrix(~period, contrasts.arg="contr.sum", data=cbpp)
>> > all.equal(mf1,mf2) ## TRUE
>> > mf3 <- model.matrix(~period, contrasts.arg=contr.sum, data=cbpp)
>> > all.equal(mf1,mf3) ## TRUE
>> > mf4 <- model.matrix(~period, contrasts.arg=list(period=contr.sum),
>> > data=cbpp)
>> > isTRUE(all.equal(mf1,mf4)) ## FALSE
>> >...
2019 Feb 23
1
model.matrix.default() silently ignores bad contrasts.arg
...gt; >> > data(cbpp, package="lme4") >> > mf1 <-
>> model.matrix(~period, data=cbpp) >> > mf2 <-
>> model.matrix(~period, contrasts.arg="contr.sum",
>> data=cbpp) >> > all.equal(mf1,mf2) ## TRUE >> > mf3 <-
>> model.matrix(~period, contrasts.arg=contr.sum, data=cbpp)
>> >> > all.equal(mf1,mf3) ## TRUE >> > mf4 <-
>> model.matrix(~period,
>> contrasts.arg=list(period=contr.sum), >> > data=cbpp) >>
>> > isTRUE...
2019 Feb 21
0
model.matrix.default() silently ignores bad contrasts.arg
...ith no contrasts argument, followed by two wrong contrasts
arguments, followed by a correct contrasts argument.
data(cbpp, package="lme4")
mf1 <- model.matrix(~period, data=cbpp)
mf2 <- model.matrix(~period, contrasts.arg="contr.sum", data=cbpp)
all.equal(mf1,mf2) ## TRUE
mf3 <- model.matrix(~period, contrasts.arg=contr.sum, data=cbpp)
all.equal(mf1,mf3) ## TRUE
mf4 <- model.matrix(~period, contrasts.arg=list(period=contr.sum),
data=cbpp)
isTRUE(all.equal(mf1,mf4)) ## FALSE
I've attached a potential patch for this, which is IMO the mildest
possible case...
2004 Feb 05
0
correction to the previously asked question (about mergin g factors)
...=TRUE))
> f3 <- factor(sample(letters[5:7], 1e4, replace=TRUE))
>
> system.time(for (i in 1:1e2) mf <- mergeFac(f1, f2, f3))
[1] 4.54 0.00 4.73 NA NA
> system.time(for (i in 1:1e2) mf2 <- mergeFac2(f1, f2, f3))
[1] 3.95 0.01 4.11 NA NA
> system.time(for (i in 1:1e2) mf3 <- mergeFac3(f1, f2, f3))
[1] 3.61 0.00 3.76 NA NA
> all(mf == mf2)
[1] TRUE
> all(mf == mf3)
[1] TRUE
First, my attempt at generalizing Spencer's suggestion:
mergeFac <- function(...) {
l <- list(...)
len <- sapply(l, length)
lev <- unique(unlist(lapply(l, leve...
2019 Feb 21
0
model.matrix.default() silently ignores bad contrasts.arg
...arguments, followed by a correct contrasts argument.
> >
> > data(cbpp, package="lme4")
> > mf1 <- model.matrix(~period, data=cbpp)
> > mf2 <- model.matrix(~period, contrasts.arg="contr.sum", data=cbpp)
> > all.equal(mf1,mf2) ## TRUE
> > mf3 <- model.matrix(~period, contrasts.arg=contr.sum, data=cbpp)
> > all.equal(mf1,mf3) ## TRUE
> > mf4 <- model.matrix(~period, contrasts.arg=list(period=contr.sum),
> > data=cbpp)
> > isTRUE(all.equal(mf1,mf4)) ## FALSE
> >
> >
> > I've attached...
2019 Feb 22
0
model.matrix.default() silently ignores bad contrasts.arg
...t; >> > data(cbpp, package="lme4")
> >> > mf1 <- model.matrix(~period, data=cbpp)
> >> > mf2 <- model.matrix(~period, contrasts.arg="contr.sum", data=cbpp)
> >> > all.equal(mf1,mf2) ## TRUE
> >> > mf3 <- model.matrix(~period, contrasts.arg=contr.sum, data=cbpp)
> >> > all.equal(mf1,mf3) ## TRUE
> >> > mf4 <- model.matrix(~period, contrasts.arg=list(period=contr.sum),
> >> > data=cbpp)
> >> > isTRUE(all.equal(mf1,mf4)) ## FAL...