Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Negative correlations with sparseDecom2 #741

Closed
rosebruf opened this issue Mar 22, 2019 · 18 comments
Closed

Negative correlations with sparseDecom2 #741

rosebruf opened this issue Mar 22, 2019 · 18 comments

Comments

@rosebruf
Copy link

Hello,
I'm am using sCCAn to explore the correlation between errors and atrophy. A priori, I know this correlation should be negative: more errors correlates with less volume.
However, sparseDecom2 converges to positive correlations.
Is it possible to specify that I am only interested in negative correlations and reject positive correlations with the eigenvectors?
Thanks for your help,
Rose

@stnava
Copy link
Member

stnava commented Mar 22, 2019 via email

@dorianps
Copy link
Collaborator

dorianps commented Mar 22, 2019 via email

@stnava
Copy link
Member

stnava commented Mar 22, 2019 via email

@dorianps
Copy link
Collaborator

The same should be true with signed weights, right? The weight sign on each side combined with ccasummary should give the relationship bw a voxel on side A and a voxel on side B, unless I am missing something.

@stnava
Copy link
Member

stnava commented Mar 22, 2019 via email

@dorianps
Copy link
Collaborator

What are A_1 and A_2 in this case, different components?

@stnava
Copy link
Member

stnava commented Mar 22, 2019 via email

@dorianps
Copy link
Collaborator

I am a bit confused, maybe I should read more. My understanding is that, no matter what sparseness we choose (positive or negative, signed vs. unsigned weights), the canonical correlation would be:

correlation( voxel value A * weights A, voxel values B * weights B )

That is, just applying the weights on each side to get a component, and then correlate the components.

This is the picture I use to explain things on my slides (weights can be positive or negative):
image

@stnava
Copy link
Member

stnava commented Mar 22, 2019 via email

@dorianps
Copy link
Collaborator

Ok, good to know we are on the same page. But by this example, any relationship between A and B columns can be found simply by knowing the weight signs and the sign of ccasummary. Meaning that it shouldn't matter if weights are signed. The application of the simple rules we mentioned earlier should be sufficient to know the direction of relationship between a column in A and a column in B.

Thanks.
Dorian

@stnava
Copy link
Member

stnava commented Mar 22, 2019 via email

@dorianps
Copy link
Collaborator

Maybe we can have a chat about this approach. So far I have allowed LESYMAP to search for negative sparseness (aka signed weights) and things seem to work well (also matching the outputs of an SVR approach). The computation I use to predict behavior using voxel weights is here.

@dorianps
Copy link
Collaborator

And this is the code I use to orient the weights of voxels in the correct relationship with behavior, related to this topic.
https://github.com/dorianps/LESYMAP/blob/master/R/lsm_sccan.R#L211-L214

@stnava
Copy link
Member

stnava commented Mar 26, 2019

SCCAN will work regardless of whether you constrain the weights to be signed or not ... but the directionality is not a meaningful concept here because of this: https://blogs.sas.com/content/iml/2017/08/07/eigenvectors-not-unique.html

furthermore, when eigenvectors are signed, we can effectively interpret them as measuring differences between regions. so it is not "higher A relates to higher B" it is " the difference between region_1 in A and region_2 in A are related to higher B" or maybe even "the difference between region_1 in A and region_2 in A are related to the difference between region_3 in B and region_4 in B"

@dorianps
Copy link
Collaborator

Thanks for following up.

In the LESYMAP case we have (e.g.) 100,000 columns on one side (voxels) and 1 column on the other side (behavior), which should at least resolve the complication of having multiple regions in B. I am not thinking that the magnitude of voxel weights can tell me the degree of relationship with behavior for the reason you mention above, but at least those weight signs, combined with the correlation sign, and with the behavior weight sign, should tell me the direction of relationship between a voxel and behavior. That is, at least know that, after flipping the sign of the weights correctly with respect to behavior with the above code, someone can take a negative weight and say that that the increase of signal in that voxel is inversely related to the increase in behavior scores.

Remember, this is all done to match the sign of traditional univariate scores (i.e., t-scores) with the sign of SCCAN weights so that at least voxel signs have a similar meaning in univariate and multivariate analysis. Sorry for returning to this topic again and again but I need to figure out if something is wrong in the LESYMAP code, or if a completely different approach must be taken, i.e., your proposal of using 2 components to split the eventual positive and negative sides (but I suspect that I would need to flip the signs with the above code in that case, too).

@stnava
Copy link
Member

stnava commented Mar 26, 2019

i see your point but i think you are wrong. here is an example:

set.seed( 99099 )
n = 50
p = 500
voxels = matrix( rnorm( n * p , 0, 1 ) , nrow = n )
inds1 = sample( 1:p )[1:10]
inds2 = sample( 1:p )[1:10]
behavior = rowMeans( voxels[ , inds1 ]  - voxels[ , inds2 ] )  
cor( behavior, voxels[ , inds1 ]  )
cor( behavior, voxels[ , inds2 ]  )

if you look at the individual voxel correlations, they are not necessarily related to behavior. it is the collection and full set of differences that matters.

the larger the number of voxels, the more complicated this gets.

@dorianps
Copy link
Collaborator

I assume the problem with example you showed is that all inds2 voxels should be negatively correlated with behavior, most of which are but not all. Got the point. SCCAN however smooths the weights in internal iterations, maybe part of this problem is mitigated. I also ran SCCAN on your example and each time I run I see no problem. All weights that are supposed to be positive are positive (or zero), and vice versa all supposedly negatives are negative.


library(ANTsR)
set.seed( 199099 )
n = 50
p = 500
voxsample = 10
voxels = matrix( rnorm( n * p , 0, 1 ) , nrow = n )

# first half region A, second half region B
inds1 = sample( 1:(p/2) )[1:voxsample] # voxel samples A
inds2 = sample( (p/2+1):p )[1:voxsample] # voxel samples B

voxmat = cbind(voxels[ , inds1 ] , voxels[ , inds2 ])
behavior = cbind( rowMeans( voxels[ , inds1] - voxels[ , inds2] ) )

sccan = sparseDecom2(inmatrix = list(voxels, behavior), inmask = c(NA,NA),
                     nvecs = 1, sparseness = c(-0.2, -0.99), its = 20, robust = 1)

sccan$eig1[inds1]
sccan$eig1[inds2]
sccan$eig2
sccan$ccasummary

@stnava
Copy link
Member

stnava commented Mar 26, 2019 via email

@cookpa cookpa closed this as completed Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants