[R] Fw: Hist & kernel density estimates

maram salem marammagdysalem at yahoo.com
Wed Aug 19 18:02:08 CEST 2009



For the hist estimate
>par(mex=1.3)
>dens<-density(q)
>options(scipen=4)
> ylim<-range(dens$y)
> h<-hist(q,breaks="scott",freq=FALSE,probability=TRUE,
+  right=FALSE,xlim=c(9000,16000),ylim=ylim,main="Histogram of q(scott)")
> lines(dens)
>box()
 
For the kernel estimate>options(scipen=4)
> d <- density(q, bw = "nrd0",kernel="gaussian")
> d
> plot(d)
 
In fact the variable q is a vector of 1000 simulated values; that is I generated 1000 samples from the pareto distribution, from each sample I calculated the value of q ( a certain fn in the sample observations), and thus I was left with 1000 values of q and I don't know the distribution of q.

Hence, I used the attached codes for histogram and kernel density estimation toestimate the density of q.

But what I'm really intersed in is to estimate the probability that q is greater than a certain value , for ex.,P(q>11000), using the density estimates I obtained.
 Could u help me with a fn or some document to do this?
Thank u so much

Maram


      
Dear All,
Attached are the codes of a histogram & a kernel density estimate and the output they produced. I'll copy the codes here in case there's something wrong with the attachement


      
-------------- next part --------------
______________________________________________
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.


More information about the R-help mailing list