1

I'm trying to create a specific distribution in Matlab to sample from. I want to model some processes that are distributed as ARG (Autoregressive Gamma).

A process v is said to be ARG(a, b, c) if it is of the form v ~ Gamma(a + zt, c)

where zt, ~ Poisson (bvt-1 /c)

The parameters a, b, c correspond, respectively, to a degree of freedom, a measure of serial dependence, and a scale parameter.

I know MATLAB has Poisson and Gamma distributions built in, but I'm not sure how to create a custom distribution function incorporating both of these.

I want to create a function for sampling from processes that follow ARG dynamics. For example, MATLAb has

R = mvnrnd(MU,SIGMA)

to generate random numbers from the normal distribution. How can I create something similar for ARG?

Edit:

An attempted implementation:

function [v] = ARG(a, b, c, startval )

%a = delta
%b = rho
%c = (1-rho)*(1-gamma^2)/delta

v_lag = startval

z = poissrnd(b*v_lag / c) 

v = gamrnd(a + z, c) 
beeba
  • 422
  • 9
  • 33
  • Just call `poissrnd` with the suitable input and use the result as the parameter `zt`, from which you compute the first input to `gammarnd` – Luis Mendo Sep 21 '16 at 15:25
  • Please see my edit. Is that what you meant? Then I suppose I can loop the function N times to get a desired vector of sample errors. – beeba Sep 21 '16 at 16:26
  • Yes, that's what I meant. No need for a loop; you can specify the desired size as input arguments to [`poissrnd`](http://es.mathworks.com/help/stats/poissrnd.html) and [`gammarnd`](http://es.mathworks.com/help/stats/gamrnd.html) – Luis Mendo Sep 21 '16 at 16:28
  • Yeah that is a better solution, thank you for helping me out – beeba Sep 21 '16 at 16:31

0 Answers0