[R] Problems using lmer {lme4}

2013-05-17 Thread Andrea Goijman
Dear R list,

I'm attaching a sample of my data which consists on the presence/absence
(punto6, binomial n=5 occasions)
of different species (sp), on different sites (site) within routes
('route).

First, I want to be able to find if there is autocorrelation of the
response variable between
the sites within each route. For this I start testing 2 models, but when I
try to run the second model,
to test for the random effects of sites within routes R stops working!

I'm not being able to find out why r is crashing... and whay am I doing
wrong.

Thanks!

Andrea

###
#dput(d)

d-structure(list(site = structure(c(55L, 56L, 57L, 58L, 59L, 60L,
55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L,
56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L,
57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 229L, 230L,
231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L, 229L,
230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L,
229L, 230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L,
234L, 229L, 230L, 231L, 232L, 233L, 234L, 331L, 332L, 333L, 334L,
335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L, 333L,
334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L,
333L, 334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L,
332L, 333L, 334L, 335L, 336L, 389L, 390L, 391L, 392L, 393L, 394L,
389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L, 393L,
394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L,
393L, 394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L,
392L, 393L, 394L, 205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L,
207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L, 205L,
206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L,
205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L,
210L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L,
167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L,
166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L,
165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 247L,
248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L,
247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L,
252L, 247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L,
251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L), .Label = c(102-1,
102-2, 102-3, 102-4, 102-5, 102-6, 1023-1, 1023-2,
1023-3, 1023-4, 1023-5, 1023-6, 1027-1, 1027-2, 1027-3,
1027-4, 1027-5, 1027-6, 1028-1, 1028-2, 1028-3, 1028-4,
1028-5, 1028-6, 1032-1, 1032-2, 1032-3, 1032-4, 1032-5,
1032-6, 1034-1, 1034-2, 1034-3, 1034-4, 1034-5, 1034-6,
1036-1, 1036-2, 1036-3, 1036-4, 1036-5, 1036-6, 1041-1,
1041-2, 1041-3, 1041-4, 1041-5, 1041-6, 1046-1, 1046-2,
1046-3, 1046-4, 1046-5, 1046-6, 105-1, 105-2, 105-3,
105-4, 105-5, 105-6, 107-1, 107-2, 107-3, 107-4,
107-5, 107-6, 108-1, 108-2, 108-3, 108-4, 108-5,
108-6, 1101-1, 1101-2, 1101-3, 1101-4, 1101-5, 1101-6,
1104-1, 1104-2, 1104-3, 1104-4, 1104-5, 1104-6, 1108-1,
1108-2, 1108-3, 1108-4, 1108-5, 1108-6, 111-1, 111-2,
111-3, 111-4, 111-5, 111-6, 1113-1, 1113-2, 1113-3,
1113-4, 1113-5, 1113-6, 1116-1, 1116-2, 1116-3, 1116-4,
1116-5, 1116-6, 1121-1, 1121-2, 1121-3, 1121-4, 1121-5,
1121-6, 1204-1, 1204-2, 1204-3, 1204-4, 1204-5, 1204-6,
1205-1, 1205-2, 1205-3, 1205-4, 1205-5, 1205-6, 1207-1,
1207-2, 1207-3, 1207-4, 1207-5, 1207-6, 1212-1, 1212-2,
1212-3, 1212-4, 1212-5, 1212-6, 202-1, 202-2, 202-3,
202-4, 202-5, 202-6, 205-1, 205-2, 205-3, 205-4,
205-5, 205-6, 207-1, 207-2, 207-3, 207-4, 207-5,
207-6, 208-1, 208-2, 208-3, 208-4, 208-5, 208-6,
211-1, 211-2, 211-3, 211-4, 211-5, 211-6, 213-1,
213-2, 213-3, 213-4, 213-5, 213-6, 214-1, 214-2,
214-3, 214-4, 214-5, 214-6, 217-1, 217-2, 217-3,
217-4, 217-5, 217-6, 218-1, 218-2, 218-3, 218-4,
218-5, 218-6, 219-1, 219-2, 219-3, 219-4, 219-5,
219-6, 223-1, 223-2, 223-3, 223-4, 223-5, 223-6,
302-1, 302-2, 302-3, 302-4, 302-5, 302-6, 305-1,
305-2, 305-3, 305-4, 305-5, 305-6, 308-1, 308-2,
308-3, 308-4, 308-5, 308-6, 311-1, 311-2, 311-3,
311-4, 311-5, 311-6, 401-1, 401-2, 401-3, 401-4,
401-5, 401-6, 402-1, 402-2, 402-3, 402-4, 402-5,
402-6, 405-1, 405-2, 405-3, 405-4, 405-5, 405-6,
407-1, 407-2, 407-3, 407-4, 407-5, 407-6, 408-1,
408-2, 408-3, 408-4, 408-5, 408-6, 410-1, 410-2,
410-3, 410-4, 410-5, 410-6, 411-1, 411-2, 411-3,
411-4, 411-5, 411-6, 414-1, 414-2, 414-3, 414-4,
414-5, 414-6, 416-1, 416-2, 416-3, 416-4, 416-5,
416-6, 417-1, 417-2, 417-3, 417-4, 417-5, 417-6,
420-1, 420-2, 420-3, 420-4, 420-5, 420-6, 423-1,
423-2, 423-3, 423-4, 423-5, 423-6, 501-1, 501-2,
501-3, 501-4, 501-5, 501-6, 502-1, 502-2, 502-3,
502-4, 502-5, 502-6, 504-1, 504-2, 504-3, 504-4,
504-5, 504-6, 505-1, 505-2, 505-3, 505-4, 505-5,
505-6, 507-1, 507-2, 507-3, 507-4, 507-5, 507-6,
508-1, 508-2, 508-3, 508-4, 508-5, 508-6, 511-1,
511-2, 511-3, 511-4, 511-5, 511-6, 602-1, 602-2,
602-3, 602-4, 602-5, 602-6, 604-1, 604-2, 604-3,
604-4, 604-5, 604-6, 605-1, 

Re: [R] Problems using lmer {lme4}

2013-05-17 Thread Bert Gunter
It would be better to post this on the r-sig-mixed-models list, I think.

-- Bert

On Fri, May 17, 2013 at 10:02 AM, Andrea Goijman
agoij...@cnia.inta.gov.ar wrote:
 Dear R list,

 I'm attaching a sample of my data which consists on the presence/absence
 (punto6, binomial n=5 occasions)
 of different species (sp), on different sites (site) within routes
 ('route).

 First, I want to be able to find if there is autocorrelation of the
 response variable between
 the sites within each route. For this I start testing 2 models, but when I
 try to run the second model,
 to test for the random effects of sites within routes R stops working!

 I'm not being able to find out why r is crashing... and whay am I doing
 wrong.

 Thanks!

 Andrea

 ###
 #dput(d)

 d-structure(list(site = structure(c(55L, 56L, 57L, 58L, 59L, 60L,
 55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L,
 56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L,
 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 229L, 230L,
 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L, 229L,
 230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L,
 229L, 230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L,
 234L, 229L, 230L, 231L, 232L, 233L, 234L, 331L, 332L, 333L, 334L,
 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L, 333L,
 334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L,
 333L, 334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L,
 332L, 333L, 334L, 335L, 336L, 389L, 390L, 391L, 392L, 393L, 394L,
 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L, 393L,
 394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L,
 393L, 394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L,
 392L, 393L, 394L, 205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L,
 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L, 205L,
 206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L,
 205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L,
 210L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L,
 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L,
 166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L,
 165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 247L,
 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L,
 247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L,
 252L, 247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L,
 251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L), .Label = c(102-1,
 102-2, 102-3, 102-4, 102-5, 102-6, 1023-1, 1023-2,
 1023-3, 1023-4, 1023-5, 1023-6, 1027-1, 1027-2, 1027-3,
 1027-4, 1027-5, 1027-6, 1028-1, 1028-2, 1028-3, 1028-4,
 1028-5, 1028-6, 1032-1, 1032-2, 1032-3, 1032-4, 1032-5,
 1032-6, 1034-1, 1034-2, 1034-3, 1034-4, 1034-5, 1034-6,
 1036-1, 1036-2, 1036-3, 1036-4, 1036-5, 1036-6, 1041-1,
 1041-2, 1041-3, 1041-4, 1041-5, 1041-6, 1046-1, 1046-2,
 1046-3, 1046-4, 1046-5, 1046-6, 105-1, 105-2, 105-3,
 105-4, 105-5, 105-6, 107-1, 107-2, 107-3, 107-4,
 107-5, 107-6, 108-1, 108-2, 108-3, 108-4, 108-5,
 108-6, 1101-1, 1101-2, 1101-3, 1101-4, 1101-5, 1101-6,
 1104-1, 1104-2, 1104-3, 1104-4, 1104-5, 1104-6, 1108-1,
 1108-2, 1108-3, 1108-4, 1108-5, 1108-6, 111-1, 111-2,
 111-3, 111-4, 111-5, 111-6, 1113-1, 1113-2, 1113-3,
 1113-4, 1113-5, 1113-6, 1116-1, 1116-2, 1116-3, 1116-4,
 1116-5, 1116-6, 1121-1, 1121-2, 1121-3, 1121-4, 1121-5,
 1121-6, 1204-1, 1204-2, 1204-3, 1204-4, 1204-5, 1204-6,
 1205-1, 1205-2, 1205-3, 1205-4, 1205-5, 1205-6, 1207-1,
 1207-2, 1207-3, 1207-4, 1207-5, 1207-6, 1212-1, 1212-2,
 1212-3, 1212-4, 1212-5, 1212-6, 202-1, 202-2, 202-3,
 202-4, 202-5, 202-6, 205-1, 205-2, 205-3, 205-4,
 205-5, 205-6, 207-1, 207-2, 207-3, 207-4, 207-5,
 207-6, 208-1, 208-2, 208-3, 208-4, 208-5, 208-6,
 211-1, 211-2, 211-3, 211-4, 211-5, 211-6, 213-1,
 213-2, 213-3, 213-4, 213-5, 213-6, 214-1, 214-2,
 214-3, 214-4, 214-5, 214-6, 217-1, 217-2, 217-3,
 217-4, 217-5, 217-6, 218-1, 218-2, 218-3, 218-4,
 218-5, 218-6, 219-1, 219-2, 219-3, 219-4, 219-5,
 219-6, 223-1, 223-2, 223-3, 223-4, 223-5, 223-6,
 302-1, 302-2, 302-3, 302-4, 302-5, 302-6, 305-1,
 305-2, 305-3, 305-4, 305-5, 305-6, 308-1, 308-2,
 308-3, 308-4, 308-5, 308-6, 311-1, 311-2, 311-3,
 311-4, 311-5, 311-6, 401-1, 401-2, 401-3, 401-4,
 401-5, 401-6, 402-1, 402-2, 402-3, 402-4, 402-5,
 402-6, 405-1, 405-2, 405-3, 405-4, 405-5, 405-6,
 407-1, 407-2, 407-3, 407-4, 407-5, 407-6, 408-1,
 408-2, 408-3, 408-4, 408-5, 408-6, 410-1, 410-2,
 410-3, 410-4, 410-5, 410-6, 411-1, 411-2, 411-3,
 411-4, 411-5, 411-6, 414-1, 414-2, 414-3, 414-4,
 414-5, 414-6, 416-1, 416-2, 416-3, 416-4, 416-5,
 416-6, 417-1, 417-2, 417-3, 417-4, 417-5, 417-6,
 420-1, 420-2, 420-3, 420-4, 420-5, 420-6, 423-1,
 423-2, 423-3, 423-4, 423-5, 423-6, 501-1, 501-2,
 501-3, 501-4, 501-5, 501-6, 502-1, 502-2, 502-3,
 502-4, 502-5, 502-6, 504-1, 504-2, 504-3, 504-4,
 504-5, 504-6, 505-1, 

Re: [R] Problems using lmer {lme4}

2013-05-17 Thread agoijman
Thanks! I didn't know about that list. I forwarded my question  there

Andrea
Bert Gunter wrote
 It would be better to post this on the r-sig-mixed-models list, I think.
 
 -- Bert
 
 On Fri, May 17, 2013 at 10:02 AM, Andrea Goijman
 lt;

 agoijman@.gov

 gt; wrote:
 Dear R list,

 I'm attaching a sample of my data which consists on the presence/absence
 (punto6, binomial n=5 occasions)
 of different species (sp), on different sites (site) within routes
 ('route).

 First, I want to be able to find if there is autocorrelation of the
 response variable between
 the sites within each route. For this I start testing 2 models, but when
 I
 try to run the second model,
 to test for the random effects of sites within routes R stops working!

 I'm not being able to find out why r is crashing... and whay am I doing
 wrong.

 Thanks!

 Andrea

 ###
 #dput(d)

 d-structure(list(site = structure(c(55L, 56L, 57L, 58L, 59L, 60L,
 55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L,
 56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L,
 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 229L, 230L,
 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L, 229L,
 230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L,
 229L, 230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L,
 234L, 229L, 230L, 231L, 232L, 233L, 234L, 331L, 332L, 333L, 334L,
 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L, 333L,
 334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L,
 333L, 334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L,
 332L, 333L, 334L, 335L, 336L, 389L, 390L, 391L, 392L, 393L, 394L,
 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L, 393L,
 394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L,
 393L, 394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L,
 392L, 393L, 394L, 205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L,
 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L, 205L,
 206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L,
 205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L,
 210L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L,
 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L,
 166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L,
 165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 247L,
 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L,
 247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L,
 252L, 247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L,
 251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L), .Label = c(102-1,
 102-2, 102-3, 102-4, 102-5, 102-6, 1023-1, 1023-2,
 1023-3, 1023-4, 1023-5, 1023-6, 1027-1, 1027-2, 1027-3,
 1027-4, 1027-5, 1027-6, 1028-1, 1028-2, 1028-3, 1028-4,
 1028-5, 1028-6, 1032-1, 1032-2, 1032-3, 1032-4, 1032-5,
 1032-6, 1034-1, 1034-2, 1034-3, 1034-4, 1034-5, 1034-6,
 1036-1, 1036-2, 1036-3, 1036-4, 1036-5, 1036-6, 1041-1,
 1041-2, 1041-3, 1041-4, 1041-5, 1041-6, 1046-1, 1046-2,
 1046-3, 1046-4, 1046-5, 1046-6, 105-1, 105-2, 105-3,
 105-4, 105-5, 105-6, 107-1, 107-2, 107-3, 107-4,
 107-5, 107-6, 108-1, 108-2, 108-3, 108-4, 108-5,
 108-6, 1101-1, 1101-2, 1101-3, 1101-4, 1101-5, 1101-6,
 1104-1, 1104-2, 1104-3, 1104-4, 1104-5, 1104-6, 1108-1,
 1108-2, 1108-3, 1108-4, 1108-5, 1108-6, 111-1, 111-2,
 111-3, 111-4, 111-5, 111-6, 1113-1, 1113-2, 1113-3,
 1113-4, 1113-5, 1113-6, 1116-1, 1116-2, 1116-3, 1116-4,
 1116-5, 1116-6, 1121-1, 1121-2, 1121-3, 1121-4, 1121-5,
 1121-6, 1204-1, 1204-2, 1204-3, 1204-4, 1204-5, 1204-6,
 1205-1, 1205-2, 1205-3, 1205-4, 1205-5, 1205-6, 1207-1,
 1207-2, 1207-3, 1207-4, 1207-5, 1207-6, 1212-1, 1212-2,
 1212-3, 1212-4, 1212-5, 1212-6, 202-1, 202-2, 202-3,
 202-4, 202-5, 202-6, 205-1, 205-2, 205-3, 205-4,
 205-5, 205-6, 207-1, 207-2, 207-3, 207-4, 207-5,
 207-6, 208-1, 208-2, 208-3, 208-4, 208-5, 208-6,
 211-1, 211-2, 211-3, 211-4, 211-5, 211-6, 213-1,
 213-2, 213-3, 213-4, 213-5, 213-6, 214-1, 214-2,
 214-3, 214-4, 214-5, 214-6, 217-1, 217-2, 217-3,
 217-4, 217-5, 217-6, 218-1, 218-2, 218-3, 218-4,
 218-5, 218-6, 219-1, 219-2, 219-3, 219-4, 219-5,
 219-6, 223-1, 223-2, 223-3, 223-4, 223-5, 223-6,
 302-1, 302-2, 302-3, 302-4, 302-5, 302-6, 305-1,
 305-2, 305-3, 305-4, 305-5, 305-6, 308-1, 308-2,
 308-3, 308-4, 308-5, 308-6, 311-1, 311-2, 311-3,
 311-4, 311-5, 311-6, 401-1, 401-2, 401-3, 401-4,
 401-5, 401-6, 402-1, 402-2, 402-3, 402-4, 402-5,
 402-6, 405-1, 405-2, 405-3, 405-4, 405-5, 405-6,
 407-1, 407-2, 407-3, 407-4, 407-5, 407-6, 408-1,
 408-2, 408-3, 408-4, 408-5, 408-6, 410-1, 410-2,
 410-3, 410-4, 410-5, 410-6, 411-1, 411-2, 411-3,
 411-4, 411-5, 411-6, 414-1, 414-2, 414-3, 414-4,
 414-5, 414-6, 416-1, 416-2, 416-3, 416-4, 416-5,
 416-6, 417-1, 417-2, 417-3, 417-4, 417-5, 417-6,
 420-1, 420-2, 420-3, 420-4, 420-5, 420-6, 423-1,
 423-2, 423-3, 423-4, 423-5, 423-6, 501-1, 501-2,
 501-3, 501-4, 501-5, 

Re: [R] Problems using lmer {lme4}

2013-05-17 Thread Patrick Coulombe
Hi Andrea,

I'm not exactly sure what you're trying to do, but you've included a
random effect for a site coefficient that's not even in your list of
fixed effects... you're basically allowing the coefficient for site to
vary across routes, but you're never including the coefficient in the
first place. Given the appropriate nested structure (I haven't looked
at your data), a model that should run would be:

m2 - lmer(cbind(punto6,5) ~ sp + site + (site|route) ,family=binomial,data = d)

The problem here is I'm not sure this is what you mean to do... If you
could way simplify your example (for example, by including a small
number of mock observations with only the relevant variables, in a
table instead of in R syntax), that would be helpful.

Patrick

2013/5/17 Andrea Goijman agoij...@cnia.inta.gov.ar:
 Dear R list,

 I'm attaching a sample of my data which consists on the presence/absence
 (punto6, binomial n=5 occasions)
 of different species (sp), on different sites (site) within routes
 ('route).

 First, I want to be able to find if there is autocorrelation of the
 response variable between
 the sites within each route. For this I start testing 2 models, but when I
 try to run the second model,
 to test for the random effects of sites within routes R stops working!

 I'm not being able to find out why r is crashing... and whay am I doing
 wrong.

 Thanks!

 Andrea

 ###
 #dput(d)

 d-structure(list(site = structure(c(55L, 56L, 57L, 58L, 59L, 60L,
 55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L,
 56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L,
 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 229L, 230L,
 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L, 229L,
 230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L,
 229L, 230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L,
 234L, 229L, 230L, 231L, 232L, 233L, 234L, 331L, 332L, 333L, 334L,
 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L, 333L,
 334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L,
 333L, 334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L,
 332L, 333L, 334L, 335L, 336L, 389L, 390L, 391L, 392L, 393L, 394L,
 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L, 393L,
 394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L,
 393L, 394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L,
 392L, 393L, 394L, 205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L,
 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L, 205L,
 206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L,
 205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L,
 210L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L,
 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L,
 166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L,
 165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 247L,
 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L,
 247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L,
 252L, 247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L,
 251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L), .Label = c(102-1,
 102-2, 102-3, 102-4, 102-5, 102-6, 1023-1, 1023-2,
 1023-3, 1023-4, 1023-5, 1023-6, 1027-1, 1027-2, 1027-3,
 1027-4, 1027-5, 1027-6, 1028-1, 1028-2, 1028-3, 1028-4,
 1028-5, 1028-6, 1032-1, 1032-2, 1032-3, 1032-4, 1032-5,
 1032-6, 1034-1, 1034-2, 1034-3, 1034-4, 1034-5, 1034-6,
 1036-1, 1036-2, 1036-3, 1036-4, 1036-5, 1036-6, 1041-1,
 1041-2, 1041-3, 1041-4, 1041-5, 1041-6, 1046-1, 1046-2,
 1046-3, 1046-4, 1046-5, 1046-6, 105-1, 105-2, 105-3,
 105-4, 105-5, 105-6, 107-1, 107-2, 107-3, 107-4,
 107-5, 107-6, 108-1, 108-2, 108-3, 108-4, 108-5,
 108-6, 1101-1, 1101-2, 1101-3, 1101-4, 1101-5, 1101-6,
 1104-1, 1104-2, 1104-3, 1104-4, 1104-5, 1104-6, 1108-1,
 1108-2, 1108-3, 1108-4, 1108-5, 1108-6, 111-1, 111-2,
 111-3, 111-4, 111-5, 111-6, 1113-1, 1113-2, 1113-3,
 1113-4, 1113-5, 1113-6, 1116-1, 1116-2, 1116-3, 1116-4,
 1116-5, 1116-6, 1121-1, 1121-2, 1121-3, 1121-4, 1121-5,
 1121-6, 1204-1, 1204-2, 1204-3, 1204-4, 1204-5, 1204-6,
 1205-1, 1205-2, 1205-3, 1205-4, 1205-5, 1205-6, 1207-1,
 1207-2, 1207-3, 1207-4, 1207-5, 1207-6, 1212-1, 1212-2,
 1212-3, 1212-4, 1212-5, 1212-6, 202-1, 202-2, 202-3,
 202-4, 202-5, 202-6, 205-1, 205-2, 205-3, 205-4,
 205-5, 205-6, 207-1, 207-2, 207-3, 207-4, 207-5,
 207-6, 208-1, 208-2, 208-3, 208-4, 208-5, 208-6,
 211-1, 211-2, 211-3, 211-4, 211-5, 211-6, 213-1,
 213-2, 213-3, 213-4, 213-5, 213-6, 214-1, 214-2,
 214-3, 214-4, 214-5, 214-6, 217-1, 217-2, 217-3,
 217-4, 217-5, 217-6, 218-1, 218-2, 218-3, 218-4,
 218-5, 218-6, 219-1, 219-2, 219-3, 219-4, 219-5,
 219-6, 223-1, 223-2, 223-3, 223-4, 223-5, 223-6,
 302-1, 302-2, 302-3, 302-4, 302-5, 302-6, 305-1,
 305-2, 305-3, 305-4, 305-5, 305-6, 308-1, 308-2,
 308-3, 308-4, 308-5, 308-6, 311-1, 311-2, 311-3,
 311-4, 311-5, 311-6, 

Re: [R] Problems using lmer {lme4}

2013-05-17 Thread Andrea Goijman
Hi Patrick,

Thanks for you reply. I tried adding site fixed effect as you told me, but
the program failed again (R stopped working).
Basically, what I am trying to do is to test for auto-correlation between
sites within routes. My survey takes place in routes, but each route is
divided in segments (or sites), and the presence of the species is
monitored at a site level.
A simple table for one species only would be as follows:

  Route site Visit1 Visit2 Visit3 Visit4 Visit5 #detections (punto6)  1 1-1
1 0 0 0 1 2  1 1-2 1 1 1 1 0 4  1 1-3 0 1 1 1 1 4  1 1-4 0 1 1 0 0 2  1 1-5
1 0 0 0 1 2  2 2-1 0 0 1 1 1 3  2 2-2 1 1 1 1 1 5  2 2-3 0 0 0 1 0 1  2 2-4
0 0 1 1 1 3  2 2-5 0 0 1 0 1 2  3 3-1 1 1 0 1 0 3  3 3-2 1 0 1 1 1 4  3 3-3
1 0 1 1 1 4  3 3-4 0 1 1 1 0 3  3 3-5 0 0 0 1 1 2


On Fri, May 17, 2013 at 2:15 PM, Patrick Coulombe 
patrick.coulo...@gmail.com wrote:

 Hi Andrea,

 I'm not exactly sure what you're trying to do, but you've included a
 random effect for a site coefficient that's not even in your list of
 fixed effects... you're basically allowing the coefficient for site to
 vary across routes, but you're never including the coefficient in the
 first place. Given the appropriate nested structure (I haven't looked
 at your data), a model that should run would be:

 m2 - lmer(cbind(punto6,5) ~ sp + site + (site|route)
 ,family=binomial,data = d)

 The problem here is I'm not sure this is what you mean to do... If you
 could way simplify your example (for example, by including a small
 number of mock observations with only the relevant variables, in a
 table instead of in R syntax), that would be helpful.

 Patrick

 2013/5/17 Andrea Goijman agoij...@cnia.inta.gov.ar:
  Dear R list,
 
  I'm attaching a sample of my data which consists on the presence/absence
  (punto6, binomial n=5 occasions)
  of different species (sp), on different sites (site) within routes
  ('route).
 
  First, I want to be able to find if there is autocorrelation of the
  response variable between
  the sites within each route. For this I start testing 2 models, but when
 I
  try to run the second model,
  to test for the random effects of sites within routes R stops working!
 
  I'm not being able to find out why r is crashing... and whay am I doing
  wrong.
 
  Thanks!
 
  Andrea
 
  ###
  #dput(d)
 
  d-structure(list(site = structure(c(55L, 56L, 57L, 58L, 59L, 60L,
  55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L,
  56L, 57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 55L, 56L,
  57L, 58L, 59L, 60L, 55L, 56L, 57L, 58L, 59L, 60L, 229L, 230L,
  231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L, 229L,
  230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L, 234L,
  229L, 230L, 231L, 232L, 233L, 234L, 229L, 230L, 231L, 232L, 233L,
  234L, 229L, 230L, 231L, 232L, 233L, 234L, 331L, 332L, 333L, 334L,
  335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L, 333L,
  334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L, 332L,
  333L, 334L, 335L, 336L, 331L, 332L, 333L, 334L, 335L, 336L, 331L,
  332L, 333L, 334L, 335L, 336L, 389L, 390L, 391L, 392L, 393L, 394L,
  389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L, 393L,
  394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L, 392L,
  393L, 394L, 389L, 390L, 391L, 392L, 393L, 394L, 389L, 390L, 391L,
  392L, 393L, 394L, 205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L,
  207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L, 205L,
  206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L, 210L,
  205L, 206L, 207L, 208L, 209L, 210L, 205L, 206L, 207L, 208L, 209L,
  210L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L,
  167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L, 165L,
  166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 163L, 164L,
  165L, 166L, 167L, 168L, 163L, 164L, 165L, 166L, 167L, 168L, 247L,
  248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L,
  247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L, 251L,
  252L, 247L, 248L, 249L, 250L, 251L, 252L, 247L, 248L, 249L, 250L,
  251L, 252L, 247L, 248L, 249L, 250L, 251L, 252L), .Label = c(102-1,
  102-2, 102-3, 102-4, 102-5, 102-6, 1023-1, 1023-2,
  1023-3, 1023-4, 1023-5, 1023-6, 1027-1, 1027-2, 1027-3,
  1027-4, 1027-5, 1027-6, 1028-1, 1028-2, 1028-3, 1028-4,
  1028-5, 1028-6, 1032-1, 1032-2, 1032-3, 1032-4, 1032-5,
  1032-6, 1034-1, 1034-2, 1034-3, 1034-4, 1034-5, 1034-6,
  1036-1, 1036-2, 1036-3, 1036-4, 1036-5, 1036-6, 1041-1,
  1041-2, 1041-3, 1041-4, 1041-5, 1041-6, 1046-1, 1046-2,
  1046-3, 1046-4, 1046-5, 1046-6, 105-1, 105-2, 105-3,
  105-4, 105-5, 105-6, 107-1, 107-2, 107-3, 107-4,
  107-5, 107-6, 108-1, 108-2, 108-3, 108-4, 108-5,
  108-6, 1101-1, 1101-2, 1101-3, 1101-4, 1101-5, 1101-6,
  1104-1, 1104-2, 1104-3, 1104-4, 1104-5, 1104-6, 1108-1,
  1108-2, 1108-3, 1108-4, 1108-5, 1108-6, 111-1, 111-2,
  111-3, 111-4, 111-5, 111-6, 1113-1, 1113-2, 1113-3,
  1113-4,