If I have a set of data that gives the apparent partition coefficient as a function of pH, over a range of pH 2-10, how do I calculate the Ka of the compound?

I'm just thinking out loud a little to give you some ideas.

If we have an acid, and we know the partition coefficient is moles organic phase/moles aqueous phase, when the solution is pH 10 we should have mostly the salt and K should be small. At pH 2 the acid should be in the un-ionized form and K should be large. So you figure how much of each form you have and calculate Ka from that. I've never done that before and don't know if it will work.