From: Sundar Dorai-Raj <sundar.dorai-raj_at_pdf.com>

Date: Fri 13 Oct 2006 - 15:28:27 GMT

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 and provide commented, minimal, self-contained, reproducible code. Received on Sat Oct 14 02:31:08 2006

Date: Fri 13 Oct 2006 - 15:28:27 GMT

Jeffrey Stratford said the following on 10/13/2006 9:28 AM:

> Hi. I'm attempting to fit a logistic/binomial model so I can determine

*> the influence of landscape on the probability that a box gets used by a
**> bird. I've looked at a few sources (MASS text, Dalgaard, Fox and
**> google) and the examples are almost always based on tabular predictor
**> variables. My data, however are not. I'm not sure if that is the
**> source of the problems or not because the one example that includes a
**> continuous predictor looks to be coded exactly the same way. Looking at
**> the output, I get estimates for each case when I should get a single
**> estimate for purbank. Any suggestions?
**>
**> Many thanks,
**>
**> Jeff
**>
**>
**> THE DATA: (200 boxes total, used [0 if unoccupied, 1 occupied], the rest
**> are landscape variables).
**>
**> box use purbank purban2 purban1 pgrassk pgrass2 pgrass1 grassdist grasspatchk
**> 1 1 0.003813435 0.02684564 0.06896552 0.3282487 0.6845638 0.7586207 0 3.73
**> 2 1 0.04429451 0.1610738 0.1724138 0.1534174 0.3825503 0.6551724 0 1.023261
**> 3 1 0.04458785 0.06040268 0 0.1628043 0.557047 0.7586207 0 0.9605769
**> 4 1 0.06072162 0.2080537 0.06896552 0.01936052 0 0 323.1099 0.2284615
**> 5 0 0.6080962 0.6979866 0.6896552 0.03168084 0.1275168 0.2413793 30 0.2627027
**> 6 1 0.6060428 0.6107383 0.3448276 0.04077442 0.2885906 0.4482759 30 0.2978571
**> 7 1 0.3807568 0.4362416 0.6896552 0.06864183 0.03355705 0 94.86833 0.468
**> 8 0 0.3649164 0.3154362 0.4137931 0.06277501 0.1275168 0 120 0.4585714
**>
**> THE CODE:
**>
**> box.use<- read.csv("c:\\eabl\\2004\\use_logistic2.csv", header=TRUE)
**> attach(box.use)
**> box.use <- na.omit(box.use)
**> use <- factor(use, levels=0:1)
**> levels(use) <- c("unused", "used")
**> glm1 <- glm(use ~ purbank, binomial)
**>
**> THE OUTPUT:
**>
**> Coefficients:
**> Estimate Std. Error z value Pr(>|z|)
**> (Intercept) -4.544e-16 1.414e+00 -3.21e-16 1.000
**> purbank0 2.157e+01 2.923e+04 0.001 0.999
**> purbank0.001173365 2.157e+01 2.067e+04 0.001 0.999
**> purbank0.001466706 2.157e+01 2.923e+04 0.001 0.999
**> purbank0.001760047 6.429e-16 2.000e+00 3.21e-16 1.000
**> purbank0.002346729 2.157e+01 2.923e+04 0.001 0.999
**> purbank0.003813435 2.157e+01 2.923e+04 0.001 0.999
**> purbank0.004106776 2.157e+01 2.067e+04 0.001 0.999
**> purbank0.004693458 2.157e+01 2.067e+04 0.001 0.999
**>
**>
**> ****************************************
**> Jeffrey A. Stratford, Ph.D.
**> Postdoctoral Associate
**> 331 Funchess Hall
**> Department of Biological Sciences
**> Auburn University
**> Auburn, AL 36849
**> 334-329-9198
**> FAX 334-844-9234
**> http://www.auburn.edu/~stratja
**>
**> ______________________________________________
**> 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
**> and provide commented, minimal, self-contained, reproducible code.
*

That's not what I get:

lines <-

"box,use,purbank,purban2,purban1,pgrassk,pgrass2,pgrass1,grassdist,grasspatchk

1,1,0.003813435,0.02684564,0.06896552,0.3282487,0.6845638,0.7586207,0,3.73 2,1,0.04429451,0.1610738,0.1724138,0.1534174,0.3825503,0.6551724,0,1.023261 3,1,0.04458785,0.06040268,0,0.1628043,0.557047,0.7586207,0,0.9605769 4,1,0.06072162,0.2080537,0.06896552,0.01936052,0,0,323.1099,0.2284615 5,0,0.6080962,0.6979866,0.6896552,0.03168084,0.1275168,0.2413793,30,0.2627027 6,1,0.6060428,0.6107383,0.3448276,0.04077442,0.2885906,0.4482759,30,0.2978571 7,1,0.3807568,0.4362416,0.6896552,0.06864183,0.03355705,0,94.86833,0.468 8,0,0.3649164,0.3154362,0.4137931,0.06277501,0.1275168,0,120,0.4585714"box.use <- read.csv(textConnection(lines))

box.use <- na.omit(box.use)

box.use$use <- factor(box.use$use, levels=0:1)
levels(box.use$use) <- c("unused", "used")
(glm1 <- glm(use ~ purbank, binomial, box.use))

You need to check why purbank is being interpreted as a factor in your code.

Also, I removed your use of "attach" because I find it dangerous (especially with no detach). Better to be explicit.

**HTH,
**
--sundar

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 and provide commented, minimal, self-contained, reproducible code. Received on Sat Oct 14 02:31:08 2006

Archive maintained by Robert King, hosted by
the discipline of
statistics at the
University of Newcastle,
Australia.

Archive generated by hypermail 2.1.8, at Fri 13 Oct 2006 - 17:30:10 GMT.

*
Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help.
Please read the posting
guide before posting to the list.
*