You are {X:conservative,liberal}
You think you are {Y(X):conservative=>right,liberal=>smart*}
You think that people who agree with you are, therefore, also Y
You think that people who disagree with you are, therefore, !Y
You prefer the company of folks who agree with values Z and are Y
Surrounded by your Y friends with Z values feeds back into your perceptions that Y is related to Z.
*Don't forget, 70% of Americans think they're smarter than average [if you assume that it should take at least a 1-sigma difference to *notice* at all, then you shouldn't be able to base this belief on evidence more than 13.59% of the time (approximating with a normal distribution)].
Enhancing the algorithm to add political bias:
You are {X:conservative,liberal}
You think you are {Y(X):conservative=>right,liberal=>smart*}
You think that people who agree with you are, therefore, also Y
You think that people who disagree with you are, therefore, !Y
You prefer the company of folks who agree with values Z and are Y
Surrounded by your Y friends with Z values feeds back into your perceptions that Y is related to Z.
*Don't forget, 70% of Americans think they're smarter than average [if you assume that it should take at least a 1-sigma difference to *notice* at all, then you shouldn't be able to base this belief on evidence more than 13.59% of the time (approximating with a normal distribution)].