I do not recommend charging by the hour. I usually offer a package cost for various services because I usually sell that as part of what I'm offering. For example, how much somebody pays me to put their book together from interview through finished product determines the type of editing that they get. If you underprice your services and it takes longer then you thought it would, then you don't make your client subsidize your learning curve. If you overprice your services then you either won't make any sales or will be less likely to have repeat sales or referrals. If you price your services in a reasonable range, then you are offering a good value to your client (no matter how much or how little your actual time commitment or cost is) and are more likely to get repeat business and referrals and everybody will be happy. Generally speaking, I'd rather be more towards the overpricing my services range because it's been my experience that what I offer is almost always worth more to the client than what it would be worth to me or to what I think it is worth. You can get more details about my actual thought process in the $10K Books -> Suggested Pricing & Services -> Self-Pub Pricing & Services training.
If you are going to be offering an a la carte service (such as editing or ghostwriting) then it can be a little different, but I still wouldn't charge by the hour. For ghostwriting, I'd charge a flat fee for a specific amount of work (a 1000 word article or a 15000 word book for $X for example.) For editing, I would probably be outsourcing that anyway so I'd most likely charge by the number of words being edited and for the type of editing being done, most likely in the realm of some multiple of whatever my costs are. For example, for basic copyediting, I'd probably charge somewhere in the 1.5 cents to 2 cents per word, potentially with a minimum such as whatever the cost would be for 10,000 words, which is the model that CreateSpace uses if you were to have them do it for you. (They tend to be towards the high end of average for the cost; I haven't actually used them but just looking at them as a model.)