[R] Help w/ density() usage

From: Eduardo Esteves <eesteves_at_ualg.pt>
Date: Thu, 7 Feb 2008 12:47:04 -0000


Dear All,

(this msg is a statistics/computing question to the list)

I'm trying to implement a modern-version of a (classic) "several-step protocol" in Fishery Biology (due to Bhattacharya, 1967): analysis of length-frequency distribution of fish larvae to id cohorts and later estimate growh rates!

I've trouble with the 1st step: using kernel density estimation (KDE) function to examine size-freq distributions (variable sl):

> density(sl[dofyr==139],bw="nrd0") (dofyr means day of year and refers to a particular sampling date)
> kd139

Call:

        density.default(x = sl[dofyr == 139], bw = "nrd0")

Data: sl[dofyr == 139] (55 obs.); Bandwidth 'bw' = 0.4234

       x                y            
 Min.   : 4.870   Min.   :0.0001924  
 1st Qu.: 7.207   1st Qu.:0.0120950  
 Median : 9.545   Median :0.0406854  
 Mean   : 9.545   Mean   :0.1068383  

 3rd Qu.:11.883 3rd Qu.:0.1973223
 Max. :14.220 Max. :0.3491222

Now the question: the densities per x value (obtained using kd139$y) do not sum to one? I expected them to be probabilities and wanted to "extract" the smoothed frequencies for the midpoints of size-intervals (in this example each class is 0.4234 mm wide?!)

Thanks in advance,
Eduardo Esteves
University of Algarve School of Technology (Portugal)

ps-I'm trying implement the other steps of the procedure, so it's possible that I'll need help (again)!

        [[alternative HTML version deleted]]



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 Thu 07 Feb 2008 - 12:50:59 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 Thu 07 Feb 2008 - 13:30:12 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