This study analyzed the impact of the physical environment of a hospital on cognitive abilities. Using random forests, we analyzed the effects of the number of room changes and room type (private rooms or multi-bed rooms) on cognitive ability. The results showed that the physical environment (number of room changes and room type) was the fifth least important factor in assessing the degree of influence.