search for: rinvgamma

Displaying 5 results from an estimated 5 matches for "rinvgamma".

Did you mean: dinvgamma
2007 Feb 11
0
problem with rinvgamma ?
Hi, By rinvgamma(10000,1.33,2.33) , am I supposed to get a var=3 ? Tried it many times , not even close. Why is this? thanks a lot . best
2009 Oct 08
3
foreach loop - rejection method
Hi Everybody, Thanks in advance for your help. This is my first time using the foreach statement and I cant get it to work properly so here is what i have test<-function(){ repeat { cand2[l-1]<-rinvgamma(1,phi,lambda[l-1]) q2<-dinvgamma(cand2[l-1],phi,lambda[l-1]) p2<-cand2[l-1]^-1.5*exp(-y[l]^2/(2*cand2[l-1]))*exp(-((log(cand2[l-1])-mu_t_cand[l-1])^2)/2*sigmasq) ratio<-p2/(c[l-1]*q2) if (runif(1)< ratio) {break} } f2[l-1]<-min(p2,c[l-1]*q2) }} foreach(l=2:(n-1),.combine=c,.packages=...
2007 May 26
1
Why ?rmvnorm not working
Hi, My R version is 2.4.1 and I installed the the packages MASS and run command library("MASS"), however when I type ?rmvnorm, no help topic found, it worked before. I tried to ype ?rinvgamma from "MCMCpack" which works great. Anybody have idea? I also reinstalled MASS package, but when I try to type rmvnorm(), no functions found. Pat
2012 Oct 04
2
Help with R Fitting an inverse Gamma
Dear all, I am new in R and would like to ask for someone's help in understanding where I go wrong with the following code: rm(list=ls()) # Required packages library(MCMCpack) # Simulated data set.seed(1) data = rinvgamma(n=250, shape = 5, scale = 2) + 2 hist(data) # log-likelihood ll = function(par){ if(par[1]>0 & par[2]>0 & par[3]<min(data)) return( -sum(log(dinvgamma(data- par[3],par[1],par[2]))) ) else return(Inf) } # MLE mle = optim(c(5,2,2),ll) params = mle$par # Fit hist(data,probabili...
2007 Feb 13
0
Really need help here
Hi there, I had a serious problem here . Consider the following Bayesian model(discretized variance gamma): #Likelihood J[i]<-lambda*G[i]+sigma*sqrt(G[i])*rnorm(0,1) G[i]<-rgamma(1/nu,1/nu) #Prior: nu<-rinvgamma(m,M) # Parameters lambda=-.04 ; sigam=.38; nu=6.48; m=10,M=10 ; T=5000 (length of data) An author claimed that he got posterior distribution of nu with standard deviation .0965 But I could only get posterior sd=.84 with the same setting. I have been working on my code for quite a while , b...