Nothing
#' @title Simulation routine for IHG models
#' @aliases simihg
#' @description Generate \eqn{n} pseudo-random observations following the given IHG distribution.
#' @keywords distribution
#' @usage simihg(n,m,theta)
#' @export simihg
#' @param n Number of simulated observations
#' @param m Number of ordinal categories
#' @param theta Preference parameter
#' @seealso \code{\link{probihg}}
#' @examples
#' n<-300
#' m<-9
#' theta<-0.4
#' simulation<-simihg(n,m,theta)
#' plot(table(simulation),xlab="Number of categories",ylab="Frequencies")
simihg <-
function(n,m,theta){
B<-(m-1)*theta/(1-theta)
psi<-1-runif(n)^(1/B)
vett<-1+rbinom(n,m-1,psi)
return(vett)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.