There is no simple function for the attenuation; like Scott says it's frequency dependent. One method the brain uses to detect the source's direction is the time difference between the arrival of the sound between both ears. Suppose the left ear receives the signal 0.1 ms earlier. Sound speed in air in 330 m/s, then 0.1 ms means the path from left ear to the source is 33 cm shorter than from right ear. But that doesn't give you enough information; you can find an infinite number of solutions in all directions and distances.
The root locus is a plane with equation
\$ \sqrt{(x-x_L)^2 + (y-y_L)^2 + (z-z_L)^2} + 0.33 m = \sqrt{(x-x_R)^2 + (y-y_R)^2 + (z-z_R)^2} \$
where \$ (x_L, y_L, z_L)\$ is the location of the left ear in space and \$ (x_R, y_R, z_R)\$ that of the right ear. So how come that we can estimate both direction and distance quite accurately? That's where the frequency as a function of direction comes in. It reduces the number of solutions, and you may have noticed that for even more accurate location of the source we will slightly turn our head. That gives us a new equation for new left and right ear and a new plane equation.
You may also have noticed that in general it's a lot harder to locate the source of a sine sound than that of a more complex sound, read: a wider spectrum. That's because if you only have 1 frequency that's the reference level for your ear, but there are no other frequencies to compare with. In the 90s of last century in the UK they experimented with a different siren sound for ambulances: the familiar sound was interleaved with short noise bursts, exactly because noise contains a wide range of frequencies, so their mutual levels give you lots more information. Or should, because I didn't hear about the experiment again, and I also never heard an ambulance making that sound. It might be useful, though, because when people in their car hear an ambulance, they begin to look around to find out which direction it's coming from.
Final note: if you want to create a good stereo sound it's not sufficient to play with left and right levels to place the sound in the room. A sound will be perceived much more left of center if the right channel has a 50 µs phase delay than if it's half a dB weaker.