%Here are the initial values for parameters used in the programme. %THE FOLLOWING ARE FOR SIMULATING THE NUMBER OF COMPONENTS FAILING EACH %MONTH. THESE SIMULATED VALUES WILL BE USED TO TEST THE MODEL. n=1000; %number of components produced each month m=24; %number of months that components are produced for m2=12; %number of months observed after production finishes p = [.05 .01 .01]; %values for the parameters describing the failure rate n_sim =10; %number of simulated values for no. components failing each month given the paras "p" r= p(2) + p(1)*exp(-p(3).*(0:m+m2)); %r= failure rate rel = exp(-r); %reliabilty of a component pf = 1-rel; %prob component fails before 1 month c=5; %This is the number of cross validations that will happen. It will be from c:I. I must be between 2 and I %THE FOLLOWING ARE USED WHEN SAMPLING FROM THE PRIOR AND POSTERIOR %DISTRBTIONS. KK=100000; %number of values simulated from prior MM=10000; %number of values sampled from posterior prior_l = 10; %prior_l is the maximum initial failure rate = lambda_1 + lambda_2 prior_x_al = 1.5; %expected value of the prior distribution for alpha. prior_var_al = 3.75; %variance of the prior distribution for alpha. %prior for alpha is a gamma(a,b) - a=shape, b=scale. Expected value = %ab = prior_x_al, var = ab^2 = prior_var_al %=> %a = (prior_x_al)^2 / prior_var_al %b = prior_var_al/prior_x_al I=7; %number of observations available is I-1 since I=1 correspond to number that failed in month 0 -not defined %if real data was available, it would be put in here. Otherwise, I %simulated values for the number of component failing in month 1 to I %will be used.