function y=testparam(c, a, b, x) 
% test the probability of the GARCH parameters c,a,b given the data x
%
% c= long term average (close to cov(x))
% a= weigth of new values
% b= weigth of old values 
%
% cov_t+1 = c + a*x_t'*x_t + b*cov_t
 
s=size(x);

    % start value for cov
    cov=c;
    y=0;
    denom= sqrt((2*pi)^s(2) *det(cov)); 
    
    for n=1:s(1)
        % current tic
        x1=x(n,1:end);
        
        % current probability
        y1= x1*inv(cov)*(x1');
        y2= exp(-y1/2);
        denom = sqrt((2*pi)^s(2) *det(cov));
        y3= y2/ denom;   
        y=y+log(y3);
        
        % next days cov
        cov= (1-a-b)*c + a*(x1'*x1)+ b*cov;
    end
    cov