Hello everybody
I have some questions:
1) For generating data from Generalized pareto distribution, I used POT
package and I have example that used shape=2, but it can’t be appropriate.
2) Exact density of histogram of theta in this program doesn’t display.
i<-1
X<-rep(0, times=500)
theta<-rep(0, times=500)
X[i]<-20
theta[i]<-10
alpha<-5
k<-2
lambda<-1000
for (i in 1:500){
X[i+1]<-rgamma(1,k,theta[i])
theta[i+1]<-rgamma(1,alpha+k, lambda+X[i+1])
cat("X[i+1]" , X[i+1], "\n")
cat("theta[i+1]" , theta[i+1], "\n")
}
########Histogram of theta############
brk<-seq(0,10, by=0.0005)
hist(theta, breaks=brk,freq=FALSE,xlim=c(0,0.02), main =
paste(""),xlab="Histogram of samples values of theta")
lines(density(theta), col="red")
legend(x=0.010, y=150,"Exact Density",col="red",lty=c(1,3))
A.Rashidi
[[alternative HTML version deleted]]