In case you're stuck in Waterfall Mode, the only fairly accurate method I've used is:
- Create a Work Breakdown Structure
- Make sure it's detailed enough so you can relate the magnitude of each task to something you (or someone you can talk to) has done before.
- For each task, come up with a best-case, probable-case, and worst-case numbers based on experience. Best-case is if everything went perfectly, worst-case is if you had to re-do it over (maybe twice) and probable is somewhere in there.
- Use some weighting formula like (1*best + 4*probable + 1*worst)/6 to come up with an estimate for each task that takes the range into account.
- I've also seen variants where you can add a "risk" component to each task. The three levels of risk are 0, 1, and 2. A risk of 0 means you've done it before (or something very close), 1 means you haven't done it before, but it's done regularly in your industry, 2 means it's probably never been done before in the industry. You take the risk number and multiply that by an approximation of the "standard deviation" of your estimate. Add that to your weighted estimate. So a risk of 0 doesn't move it, but a risk of 2 moves it fairly close to your worst case number.
- Add up all the tasks.
- Add a contingency (some %) for "unknown unknowns".
You'll end up with a very precise number. I'm not saying it's accurate, but it'll be precise.
The accuracy depends entirely on being able to come up with a number for each task based on past experience, or to find someone who has done it before. The more experience you have, the better your estimates get.
When you execute the project, track your time against each task, and write down ones you missed, so you can compare. This will make you better over time.