Re: [R] weights argument in the lmer function in lme4

From: Spencer Graves <spencer.graves_at_pdf.com>
Date: Sat 04 Feb 2006 - 13:55:35 EST

          I agree: The lmer weights argument seems not to have any effect. To check this, I modified the first example in the "lmer" documentation as follows:

Sleep <- sleepstudy
Sleep$wts <- 1:180
(fm1 <- lmer(Reaction ~ Days + (Days|Subject), Sleep)) (fm1w <- lmer(Reaction ~ Days + (Days|Subject),

                      weights=wts, Sleep))

	  The numbers from both seemed to be the same.  To try to help diagnose 
this, I listed "lmer", and found that it consisted of a call to "standardGeneric". Then 'getMethods("lmer")' listed only one "method" for the case where the argument "formula" had class "formula". I tried to trace this further, e.g., by giving it a different name and using "debug". After being stopped a couple of time by functions hidden in the "Matrix" namespace, I gave ups.

          However, at least you know that it's not you. And I've included Doug Bates as a "cc" so he can use this info as he sees fit.

	  hope this helps.
	  spencer graves
	

 > sessionInfo()
R version 2.2.1, 2005-12-20, i386-pc-mingw32

attached base packages:
[1] "methods" "stats" "graphics" "grDevices" "utils" "datasets" [7] "base"

other attached packages:

      lme4 lattice Matrix
"0.995-2" "0.12-11" "0.995-4"
 >

Patrick Connolly wrote:

> I suspect the weights argument is not having any effect.
>
> Package: Matrix
> Version: 0.995-2
> Date: 2006-01-19
>
>
> Beginning with this:
>
> Browse[1]> resp.lmer <- lmer(SensSSC ~ Block + Season + (1 | Plot) + (1 | Ma) + (1 | Pa) +
> + (1 | MaPa), weights = SensSSC.N, data = xx)
>
> I group the output into a table with my ran.eff function and get this:
>
> Browse[1]> ran.eff(resp.lmer)
> 01 02 03 04 05 06 07 GCAf RankF
> A 13.714 13.709 13.886 14.124 15.120 13.546 14.586 0.472 1
> B 13.452 NA 13.426 13.632 14.439 13.512 13.713 0.069 3
> C 13.922 13.770 14.353 NA 14.661 13.529 14.367 0.453 2
> D NA NA 13.353 NA NA NA NA -0.051 4
> E 12.775 12.767 12.823 12.767 14.036 12.631 13.645 -0.495 6
> F 13.043 13.338 12.641 12.977 13.848 12.425 13.530 -0.448 5
> GCAm -0.200 -0.169 -0.165 -0.103 0.736 -0.428 0.329 NA NA
> RankM 6.000 5.000 4.000 3.000 1.000 7.000 2.000 NA NA
>
>
> Despite any shortcomings in my ran.eff function, those values look
> alright, but they're the same (to any number of decimal places) as I'd
> get without a weights argument. Just to check that the weights really
> don't effect it, I tried using only the rows with a weight of 5
> (almost 90% of the data) but it was substantially different.
>
> Browse[1]> resp.lmer5 <- lmer(SensSSC ~ Block + Season + (1 | Plot) + (1 | Ma) + (1 | Pa) +
> + (1 | MaPa), subset = SensSSC.N == 5, data = xx)
>
> Browse[1]> ran.eff(resp.lmer5)
> 01 02 03 04 05 06 07 GCAf RankF
> A 13.435 13.349 13.595 13.914 14.722 13.161 14.414 0.345 2
> B 13.068 NA 13.110 13.447 14.121 13.296 13.637 -0.014 4
> C 13.702 13.537 14.256 NA 14.371 13.575 14.247 0.469 1
> D NA NA 13.276 NA NA NA NA -0.001 3
> E 12.717 12.659 12.786 12.719 13.642 12.659 13.556 -0.425 6
> F 13.015 13.101 12.549 12.920 13.629 12.438 13.474 -0.374 5
> GCAm -0.210 -0.230 -0.146 -0.049 0.596 -0.353 0.391 NA NA
> RankM 5.000 6.000 4.000 3.000 1.000 7.000 2.000 NA NA
>
> That seems to indicate that weights cannot be readily ignored.
>
> Has anyone had experience to indicate that the weights argument does
> produce a difference, and so I should be looking somewhere else for
> the reason why I'm getting such results?
>
>
> TIA
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Feb 04 14:10:09 2006

This archive was generated by hypermail 2.1.8 : Sat 04 Feb 2006 - 21:12:41 EST