function [n_min] = bictest(d) % N_MIN = BICTEST(D) % % Creates a random training set x_1,...,x_200 of dimension D, and % reports the first N such that for all n>N the BIC selects for the % training set x_1,...,x_n the correct model (with diag. covariance) % the values of BIC scores are mising and need to be filled in N = 200; X = randn(N,d); delta_bic = []; for t=d:N, I = (1:t)'; C1 = cov(X(I,:),1); C0 = diag(diag(C1)); % here you should insert calculation of BIC score for the % Gassian models with diagonal covariance (bic_0) and full covariance % (bic_1) bic_0 = bic_1 = delta_bic = [delta_bic;bic_1-bic_0]; end; % plot(delta_bic); n_min = max(find(delta_bic>=0))+1;