[R-sig-ME] nlmer "Error: object of type 'symbol' is not subsettable"
Ben Bolker
bbolker at gmail.com
Fri Jul 20 19:31:23 CEST 2012
Amanda Henry <amanda_henry at ...> writes:
> Hi all, I want to test the effect of "species", "tech", and "area"
> on "types", controlling for "microfossil", and "sampletype", with
> "site" as a random effect, which should have random slope wrt
> "microfossil", as well as weighting the response by "microfossil".
> Microfossil and type are quantitative, the rest are factors. I have
> transformed "microfossil" to approximate a uniform distribution, it
> appears as "z.micro" in the formula.
> My data is structured as follows
>
> 'data.frame': 210 obs. of 9 variables:
> $ sample : Factor w/ 207 levels "Abri Pataud left M2",..: [snip]
> $ site : Factor w/ 20 levels "Arcy","Blombos",..: [snip]
> $ sampletype : Factor w/ 2 levels "calculus","tool": 2 2 2
> $ species : Factor w/ 2 levels "MH","N": 1 1 1 1 [snip]
> $ tech : Factor w/ 3 levels "MP/MSA","N","UP/LSA": 3 3
> $ area : Factor w/ 3 levels "A","E","NE": 3 3 3 3 3
> $ microfossil: int 7 16 0 4 5 10 6 1 25 1 ...
> $ type : int 7 8 0 4 2 7 5 1 16 1 ...
> $ z.micro : num 1.26 1.881 -1.061 0.853 1.013 ...
>
> I have used the following function
>
> res=nlmer(type~species+tech+area+sampletype+z.micro+
> (1|site)+(0+z.micro|site), weights=(microfossil+1),
> family=poisson, data=tdata)
>
> None of the categorical predictors or control factors (species, tech, area,
> sampletype) are perfectly nested or crossed with each other or with site.
>
> I have included "microfossil+1" as the weight because there are zero counts in
> microfossil and that gives an error.
>
> I receive the error:
> Error: object of type 'symbol' is not subsettable
>
> I have seen only one other instance of this problem mentioned on this mailing
> list, but it was not answered.
This isn't reproducible, so (rather than spend the time to make
up my own example) I'm going to make a few guesses.
* What else did you try -- did any simpler versions work? I.e.,
did it work without the weights specification?
* It's not at all clear to me why you're using 'nlmer' since you don't
appear to have a nonlinear function on the right-hand side of the
equation -- did you mean to use lmer? If not, what non-linear function
did you intend to use? Did you look at the examples given for ?nlmer -- ?
(i.e., this model specification looks quite different from the nlmer
example)
* do you really want microfossil+1 and not 1/(microfossil+1) as
the weights? (i.e., an _inverse_ variance weighting is more common).
Perhaps since microfossil is a count response you could/should
use glmer with a Poisson family, which would automatically take
care of the weighting (although as usual you would have to watch
out for overdispersion)?
More information about the R-sig-mixed-models
mailing list