Really depends on how you allocate costs (it was time to repaint the roof anyway before I put the panels up, so does repainting the roof count against the capital expense of the project?), how you count how much energy you saved (since power is 'free' for some values of sunk costs, using more power doesn't cost any more up to your system limits, so if you use more power at PoCo rates you'll pay the system off earlier, but you wouldn't have used that power at PoCo rates), how you count power quality and grid-down issues (which is probably not linear, a 10-minute outage and a 10-day outage would have different 'cost savings' per unit of time), plus the avoided costs of other hobbies you might have pursued (cars, boats, travel, collecting, ham radio, SCUBA diving, flying, there are some seriously expensive hobbies out there).
If you are a company putting up an array to sell power to the grid you can simplify costs (dollars per watt installed over expected lifetime against grid wholesale power sales, maintenance, and time value of money), but in our DIY world things are very different. If your only focus is economic return, there's probably a better investment.