* randprm-uniform.inc

* description: sensitivity w.r.t. parameters
* cada prm tiene dist uniforme independiente


SET prm
/
sigma_va
sigma_q
sigma_x
leselas
frisch
tfpelas
/
;


* select random values for model parameters

* plantar semilla numeros aletorios
execseed = 1 + gmillisec(jnow);

PARAMETER prmMinMax(prm,*);

prmMinMax('sigma_va','min') = 0.5;
prmMinMax('sigma_va','max') = 0.5;

prmMinMax('sigma_q','min') = 0.75;
prmMinMax('sigma_q','max') = 0.75;

prmMinMax('sigma_x','min') = 0.75;
prmMinMax('sigma_x','max') = 0.75;

prmMinMax('leselas','min') = 0.75;
prmMinMax('leselas','max') = 0.75;

prmMinMax('frisch','min') = 0.75;
prmMinMax('frisch','max') = 0.75;

prmMinMax('tfpelas','min') = 0.75;
prmMinMax('tfpelas','max') = 0.75;

PARAMETER
  prodelasRand(a)
  tradelasRand(c,trdelas)
  leselasRand(c,h)
  frischRand(h)
  tfpelasRand(a,ac)

  prodelasMin(a)
  tradelasMin(c,trdelas)
  leselasMin(c,h)
  frischMin(h)
  tfpelasMin(a,ac)

  prodelasMax(a)
  tradelasMax(c,trdelas)
  leselasMax(c,h)
  frischMax(h)
  tfpelasMax(a,ac)
  
;

prodelasMin(a) = prodelas(a,'sigma_va')*(1-prmMinMax('sigma_va','min'));
prodelasMax(a) = prodelas(a,'sigma_va')*(1+prmMinMax('sigma_va','max'));

tradelasMin(c,'sigma_q') = tradelas(c,'sigma_q')*(1-prmMinMax('sigma_q','min'));
tradelasMax(c,'sigma_q') = tradelas(c,'sigma_q')*(1+prmMinMax('sigma_q','max'));

tradelasMin(c,'sigma_x') = tradelas(c,'sigma_x')*(1-prmMinMax('sigma_x','min'));
tradelasMax(c,'sigma_x') = tradelas(c,'sigma_x')*(1+prmMinMax('sigma_x','max'));

leselasMin(c,h) = leselas(c,h)*(1-prmMinMax('leselas','min'));
leselasMax(c,h) = leselas(c,h)*(1+prmMinMax('leselas','max'));

frischMin(h) = frisch(h)*(1-prmMinMax('frisch','min'));
frischMax(h) = frisch(h)*(1+prmMinMax('frisch','max'));

tfpelasMin(a,ac)$tfpelas(a,ac) = tfpelas(a,ac)*(1-prmMinMax('tfpelas','min'));
tfpelasMax(a,ac)$tfpelas(a,ac) = tfpelas(a,ac)*(1-prmMinMax('tfpelas','max'));




* seleccionar valor parametros aletoriamente
* supuesto: dist uniforme
prodelasRand(a)  = UNIFORM(prodelasMin(a),prodelasMax(a));
tradelasRand(c,trdelas)  = UNIFORM(tradelasMin(c,trdelas),tradelasMax(c,trdelas));
leselasRand(c,h)      = UNIFORM(leselasMin(c,h),leselasMax(c,h));
frischRand(h)         = UNIFORM(frischMax(h),frischMin(h));
tfpelasRand(a,ac)$tfpelas(a,ac) = UNIFORM(tfpelasMin(a,ac),tfpelasMax(a,ac));


* asignar valor parametros
prodelas(a,'sigma_va')$prodelas(a,'sigma_va') = prodelasRand(a);
tradelas(c,trdelas)$tradelas(c,trdelas) = tradelasRand(c,trdelas);
leselas(c,h)$leselas(c,h)         = leselasRand(c,h);    
frisch(h)$frisch(h)               = frischRand(h); 
tfpelas(a,ac)$tfpelas(a,ac)       = tfpelasRand(a,ac);

      
