Trying to implement RSA with mahalanobis distance, but target DSM not positive definite

38 views
Skip to first unread message

h.iriye...@gmail.com

unread,
Jan 5, 2024, 6:34:10 AM1/5/24
to CoSMoMVPA
Hi CoSMo community,

I'm running an RSA using target_dsm_corr_measure and it works beautifully when using the standard correlation setting as a metric. However, I would like to use the "mahalanobis" option in matlab's pdist function. The problem is that my target dissimilarity matrix (based on differences in behavioral ratings between four conditions over three functional runs) is not positive definite, which is required to calculate mahalanobis distance. I've attached the target dsm. 

From my understanding, there is no straightforward or necessarily appropriate way to transform a matrix to positive definite. Is this correct? Should I abandon using mahalnobis distance and stick with the correlations? Or is there some workaround to formatting the target dsm?

Many thanks in advance and thank you for the wonderful toolbox. 

Best,
Heather
target_dsm.mat

Nick Oosterhof

unread,
Jan 7, 2024, 11:38:15 AM1/7/24
to h.iriye...@gmail.com, CoSMoMVPA
Dear Heather,

> On Jan 5, 2024, at 12:34, h.iriye...@gmail.com <h.iriye...@gmail.com> wrote:
>
> I'm running an RSA using target_dsm_corr_measure and it works beautifully when using the standard correlation setting as a metric. However, I would like to use the "mahalanobis" option in matlab's pdist function. The problem is that my target dissimilarity matrix (based on differences in behavioral ratings between four conditions over three functional runs) is not positive definite, which is required to calculate mahalanobis distance. I've attached the target dsm.
>
> From my understanding, there is no straightforward or necessarily appropriate way to transform a matrix to positive definite. Is this correct? Should I abandon using mahalnobis distance and stick with the correlations? Or is there some workaround to formatting the target dsm?

Interesting questions! Unfortunately I don’t have experience with mahalanobis distance for this use case. So I don’t feel I can give you useful advice on this. Maybe others on this mailing list have more insights. If not, I would probably use the correlation distance as you wrote.

> Many thanks in advance and thank you for the wonderful toolbox.

That’s nice to hear, thanks.

best,
Nick

h.iriye...@gmail.com

unread,
Jan 8, 2024, 4:07:33 AM1/8/24
to CoSMoMVPA
Thanks for the quick reply, Nick! Fingers crossed someone in the community has some insight. 

Best,
Heather

Reply all
Reply to author
Forward
0 new messages