Skip to content

Issue while estimate number of independent components #10

@facazevedo

Description

@facazevedo

I was trying to estimate the number of IC components using the "Standard ICA/IVA" option and the MDL (i.i.d. Sampling) but I got an error "Unrecognized function or variable "dim_n". Upon investigating the issue, I found out that the problem lied in the snippet of the function icatb_estimate_dimension.m:

%% Perform variance normalization
if verbose
    fprintf('\n Performing variance normalization ...');
end

for n = 1:size(data, 2)
    data(:, n) = detrend(data(:, n), 0) ./ std(data(:, n));
end

%% (completed)

What happened was that a few of the columns in my dataset had zero std, which made the data to contain columns of nans, which causes svd to fail later. To circumvent that, I added two lines of code that removed the columns of nan's and redefined tdim:

%% Perform variance normalization
if verbose
    fprintf('\n Performing variance normalization ...');
end

for n = 1:size(data, 2)
    data(:, n) = detrend(data(:, n), 0) ./ std(data(:, n));
end

data = data(:, ~all(isnan(data))); % modfred
tdim = size(data, 2); % modfred

%% (completed)

The code seems be able to estimate the PC's but I get the error at the end:

121 eigen values are less than or equal to machine precision

Best.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions