If a study shows that people who wear glasses have above average intelligence, assuming that everyone who wears glasses is intelligent is an example of ecological fallacy. Applying an ecological fallacy occurs when group data is used to draw conclusions about individuals.
If one particular class has the highest biology scores in the whole school district, the assumption that every student in the class has excellent biology scores would be a fallacy. There may be a few students in the class with low biology scores even if the majority of the class excels at biology. Ecological fallacy demonstrates that using group data to reach a conclusion about an individual can result in mistaken assumptions.