[R] An "unsubsettable object" in a mixed model
Ben Bolker
bbolker at gmail.com
Tue Jan 17 19:40:58 CET 2012
Sarah Jervis <sj414 <at> medschl.cam.ac.uk> writes:
>
> I am having problems using the /lme /command to fit mixed models. I have
> a data set similar to longitudinal data, except the hypothesised
> correlation is between observations taken from different individuals in
> the same family rather than from the same individual at different times.
> As soon as I try to specify any correlation structure other than
> independent, I get the error message "/Error in x$formula : object of
> type 'closure' is not subsettable/". Have you any idea what /R /is
> objecting to and how I might fix it, and if not, can you suggest h
> any other way I can get R to fit a linear mixed model? The data set is
> VERY unbalanced with almost 2/3 of the "families" being single
> individuals, so maybe /R/ doesn't like being told to find correlation in
> univariate data subsets. ANY advice is welcome!
It would help if you could provide a reproducible example, or
a test case. You're also probably better off posting this to
the r-sig-mixed-model at r-project.org mailing list. I don't know if
lme will choke when a correlation model is fitted to a data set where
some groups have only one individual, but you could (e.g.) very easily
test if this is the problem by (1) fitting the model with only groups
with n>1 and (2) adding one group with n=1 to the data set and seeing
if it chokes at that point.
However, I can also imagine that you're mis-specifying the command
in some point, and from that point of view it would be best to have
some more detail about what you're trying to do. See
http://tinyurl.com/reproducible-000 ...
More information about the R-help
mailing list