function y=basics_func(one,two,three,kkk,mmm) %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 = [one two three]; %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=3; %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 %DISTRIBTIONS. KK=kkk; %number of values simulated from prior MM=mmm; %number of values sampled from posterior prior_l = 20; %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=10; %number of observations available %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. y=[n,m,m2,p,n_sim,r,rel,pf,c,KK,MM,prior_l,prior_x_al,prior_var_al,I];