Automobiles are one of the most expensive purchases many Americans make in their lifetimes. A car or truck’s sticker price is only the beginning of this expense, however, as maintenance and repair — both anticipated and otherwise — can be costly. Just how expensive a visit to the mechanic can be varies dramatically depending on where you live.

To determine the most (and least) expensive states for car repairs, 24/7 Wall St. reviewed data on the average amount paid for parts and labor in each state. CarMD, an automotive diagnostics information company, compiled and provided the data. Across the country, American motorists shell out an average of $387.31 when the check engine light goes on. This amount ranges from as high as $435.47 in California to as little as $354.13 in Michigan.

A variety of factors determine and influence the cost of parts and labor state by state. In an interview with 24/7 Wall St., Kristin Brocoff, director of corporate communications at CarMD, explained that car repair costs can often be minimized if drivers address small issues quickly.

Across the country, the most common reason for a check engine light turning on is when there is a problem with a vehicle’s oxygen sensor. Replacing an oxygen sensor is relatively inexpensive, costing only a couple of hundred dollars in parts and labor. However, as Brocoff pointed out, if not addressed immediately, it could “potentially start to do damage to other parts of the car so then you don’t just need one part replaced, you need two.”

50.  Michigan

> Total cost of repairs: $354.13
> Avg. labor cost: $150.29 (23rd lowest)
> Avg. parts cost: $203.84 (the lowest)
> Pct. of roadway in poor condition: 13.6% (13th highest)

After the oxygen sensor, the second most common reason for a check engine light turning on is the catalytic converter, a part that can cost more than a thousand dollars. “If we’re seeing an influx of catalytic converter replacements,” Brocoff said, “maybe that tells you that those drivers are keeping their cars longer — or, they are ignoring smaller things” that have snowballed into a more serious issue.

While owner neglect and the age of a car are factors that can considerably influence the total cost of repairs, geography also makes a difference. “When you’re driving in stop and go traffic, or when there’s been a very severe winter and there’s a lot of salt on the road, we do see more frequent repairs and we do see costs go up in those situations,” Brocoff said.

Basic economics also plays a role in automotive labor costs. In an area with “lower real estate costs, everything trickles down, and the average price that they charge you per hour will be different than in California or New York.” Indeed, with the exception of Illinois, in every state where the average cost of repair is less than the national average, the overall cost of living is also below average.

The report only includes the cost of repairs for issues indicated by the check engine light and excludes other damage to mechanical parts of the car such as tires and struts. Bad road conditions can lead to mechanical issues over time, and as a result, the states with the highest cost of car maintenance are not necessarily the states with the worst roads. Still, high labor costs certainly have a larger effect on motorists’ wallets in states where roads are in poor condition.

In order to determine the most and least expensive states for car repair, 24/7 Wall St. reviewed data on the average cost of a car repair from CarMD. The total cost of repair represents the sum of the average amount paid for parts and for labor. Only repairs that were triggered by the check engine light were considered. Regional price parity figures came from the Bureau of Economic Analysis, and the percent of roadway in poor condition came from the Federal Highway Administration.

Click here to see the most expensive states to fix your car.