Not necessarily. It could be pure correlation with a hidden dependent variable - maybe the same impulses that make you a liberal also make you want to be a scientist, without there being a causal connection between them.
We can speculate on why scientists trend liberal, but there could be lots of reasons. For example, it could be that being liberal drives you towards specialties that are more abstract, or which avoid the messiness and complexity of real life. As the esteemed Dr. Raymond Stantz said, “I’ve worked in the private sector - they expect results.”
In my experience, engineering is even more lopsided than science - only in the other direction. Most engineers I know are more centrist or libertarian than is the public at large.
This study shows that while 45.2% of Ph.D’s in the physical and biological sciences describe themselves as liberal, only 10.7% of Ph.D’s in computer science and engineering call themselves liberal.
We can speculate all day about what the difference might be, but speculation will probably say more about our own biases than about real differences. For example, it seems to me that a big difference is that engineers and computer scientists work in the real world of messy answers, complexity, economic constraint, and practicality, while scientists operate in the abstract world of theory.
In the PEW poll, a large percentage of scientists said that their motivation was to solve big problems and do good for society. That’s a liberal mindset: the idea that really smart people can come up with solutions and apply them to society to make it better. Engineers and Comp Sci types are more likely to understand the limitations of what they can achieve and are more practical, hard-headed types who don’t think in terms of universal solutions to universal problems.
It’s pure liberal conceit to draw the conclusion that scientists are liberals because ‘reality has a well known liberal bias’. If that were the case, you would expect engineers, health care Ph.D’s and computer scientists to also be liberals, but they’re not. It probably has a lot more to do with the nature of the work and the environment around the work than to be any kind of statement about whether liberalism is ‘better’ or more reflective of reality. If you want to go down that road, I’d argue back that engineers and comp-sci people have a much better grasp of real-world conditions than do ivory-tower academics, and they’re not liberals.
Another potential factor for academic bias in the sciences is that the sciences saw a huge growth in population during the years when teenagers who grew up in the 60’s entered college. The paper I linked to found that the incidence of liberals spikes among faculty members who were between the ages of 50-64 in 2007. That would be the baby boom generation. Professors outside this age cohort were less liberal. Notably, the comp-sci and engineering faculties very likely trend younger than the physical sciences - notably so in the case of computing science.
Another possible source of difference - women in the social sciences. They are overwhelmingly liberal, and there are large numbers of them. Comp-sci and engineering are largely male specialties.
But finally, there’s a lot of strangeness in the data that’s simply not easy to explain. For example, 31.6% of professors of electrical engineering described themselves as Republican, while only 13.2% described themselves as Democrats. On the other hand, only 6.3% of professors of Mechanical Engineering described themselves as Republican, while 28.1% described themselves as Democrats. That’s a huge difference in political ideology between two sub-specialties of engineering. I have no idea why that would be the case. Maybe it’s just sampling error, or the effect of some powerful influencers in one of the fields or something.
One thing I will note is that ‘conservatism’ alienates all of them. I think it’s fair to say that religious conservatives alienate all highly educated people with their anti-science, anti-reason positions. It could well be why 78% of engineers and comp-sci people describe themselves as independents - they’re not liberals, but they can’t find a home in the conservative wing as long as it remains so resolutely anti-science and anti-intellectual.