Re: [R] Fit a logit curve to the data

From: Ted Harding <Ted.Harding_at_manchester.ac.uk>
Date: Fri, 14 Mar 2008 00:41:01 +0000 (GMT)


On 13-Mar-08 22:56:16, Alfonso Pérez wrote:
> Hello, my name is Alfonso. My data are 0 and 1 values in
> the y axis and fish length in the x axis. I'm trying to get
> a graph where it could be fitted a logit curve to my data,
> how could I get it?

Have a look at

  ?glm

In particular (just going on your bare statement of your problem) let 'y' denote your vector or 0/1 results:

  x <- fishlength
  y <- glm(y ~ fishlength, family=binomial)$fit   plot(x,y)
  lines(x,y)

would be a start.

However, I'm intrigued by what your variable y (more likely to be 1 as fishlength increases) might be. "Sexually mature"?

There might be a better model for it than the logistic curve.

Best wishes,
Ted.



E-Mail: (Ted Harding) <Ted.Harding_at_manchester.ac.uk> Fax-to-email: +44 (0)870 094 0861
Date: 14-Mar-08                                       Time: 00:40:59
------------------------------ XFMail ------------------------------

______________________________________________
R-help_at_r-project.org 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 Fri 14 Mar 2008 - 00:43:48 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 14 Mar 2008 - 01:30:21 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.

list of date sections of archive