[R-sig-ME] patch for pedigremm
Joehanes, Roby (NIH/NHLBI) [F]
roby.joehanes at nih.gov
Tue Jul 17 17:08:34 CEST 2012
Hi David:
I apologize for the late reply.
The patch is meant to be implemented at the source code, not at R console. That is, you need to download the source from the code tracker and retrieve the correct revision number. Then, you can apply the patch. You will need to patch both your lme4 and your pedigreemm to make it work. I have a pre-patched versions, let me know if you want them. Note that if you install my version of lme4 and pedigreemm, your version of these packages will be overwritten. Also, I only tested them in Linux. I am not aware of whether they would work on Windows or Mac.
What the patch is doing is actually to enable 1 observation per subject, which otherwise not available in the regular pedigreemm. In addition, I incorporated the latest advances of lme4 as the pedigreemm's back end.
That being said, if the matrix A you mentioned is the relationship matrix, it should always be square regardless of the length of the IDs (or the discrepancies thereof). In pedigreemm, the matrix A will be constructed automatically from the pedigree (i.e., Ped.0) in a function called "relfactor". This same function will subset the matrix A automatically to match the IDs that appear in your data. So, there is no need of extra work or even my patch for this type of problem (i.e., length(dat$id) != length(id)). The way you specified the ID discrepancies (i.e., length(dat$id) = dim(A)[1] & length(id) = dim(A)[2]) is a bit unclear to me, and I take it to mean as (length(dat$id) != length(id)).
Looking at the error message that you presented, however, it seems that there is one ID per observation (i.e., length(unique(dat$id)) == nrow(dat)). That is the use case scenario where you would need my patch.
Hope this helps,
Roby
On 6/26/12 11:50 PM, "David Aguirre-Davies" <d.aguirre at uq.edu.au> wrote:
Hi Roby,
Sorry for my incompetence, but running patches on packages is beyond my R knowledge at this stage. I would like to run the following model using pedigreemm and I get the error message below,
> fm1 <-pedigreemm(value.p ~ gen + (1|id), data=dat, pedigree = list(id=Ped.0))
Error in function (fr, FL, start, REML, verbose) :
Number of levels of a grouping factor for the random effects
must be less than the number of observations
I have followed the clues on the web, and I have attempted to implement the patch you have provide (https://r-forge.r-project.org/tracker/index.php?func=detail&aid=1928&group_id=60&atid=300), but unfortunately I have been unsuccessful.
So my question is, how can I implement the patch you provide to run an animal model where length(dat$id) = dim(A)[1] & length(id) = dim(A)[2]?
Is there are trick to implementing the patch as cut and paste into the R console doesn’t seem to work for me.
Any assistance would be much appreciated.
Regards
David Aguirre
More information about the R-sig-mixed-models
mailing list