Here is one approach:
myfun <- function(shape) { scale <- 130/shape pgamma(300, shape, scale=scale) - 0.95 } tmp <- uniroot( myfun, lower=2, upper=10 ) myshape <- tmp$root myscale <- 130/tmp$root qgamma(0.95, shape=myshape, scale=myscale) integrate( function(x) x*dgamma(x,shape=myshape,scale=myscale), lower=0, upper=Inf )
I'm not sure what you mean by an offset of 80, if this is exactly where the gamma becomes nonzero, then subtract 80 from 130 and 300 and do the same as above.
source share