Lina Rusyte
2009-Sep-29 08:51 UTC
[Rd] Probability of data values form empirical distribution
Hello, Could someone help me please and to tell how to get the probability from empirical distribution (not parametric) for each data value (R function). For example, for normal distribution there is such a function like: “pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)” I need the same function only for the empirical distribution (which does not correspond to any typical distribution). R plots the density function of any data: “plot(density(x))” I need to find out the probability for each data value from this plot-line. Best regards, Lina [[alternative HTML version deleted]]
John Nolan
2009-Sep-29 12:37 UTC
[Rd] Probability of data values form empirical distribution
The function ecdf(x) computes the empirical cdf from data in the vector x. You can plot it with plot(ecdf(x)), or compute the emp. cdf at new values, e.g. my.cdf <- ecdf(x) my.cdf( 0:3 ) # computes the emp. cdf at 0,1,2,3 John ........................................................................... John P. Nolan Math/Stat Department 227 Gray Hall American University 4400 Massachusetts Avenue, NW Washington, DC 20016-8050 jpnolan@american.edu 202.885.3140 voice 202.885.3155 fax http://academic2.american.edu/~jpnolan ........................................................................... -----r-devel-bounces@r-project.org wrote: ----- To: R help <r-help@r-project.org> From: Lina Rusyte Sent by: r-devel-bounces@r-project.org Date: 09/29/2009 04:51AM Cc: R devel <r-devel@r-project.org> Subject: [Rd] Probability of data values form empirical distribution Hello,  Could someone help me please and to tell how to get the probability from empirical distribution (not parametric) for each data value (R function). For example, for normal distribution there is such a function like:  “pnorm(q, mean = 0, sd = 1, lower.tail = TRUE, log.p = FALSE)† I need the same function only for the empirical distribution (which does not correspond to any typical distribution). R plots the density function of any data:  “plot(density(x))† I need to find out the probability for each data value from this plot-line.  Best regards, Lina [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel [[alternative HTML version deleted]]