  Using a new algorithm for estimating the actions of orbits a parametrised
distribution function is automatically fitted to observational data for the
solar neighbourhood. We adopt a gravitational potential that is generated by
three discs (gas and both thin and thick stellar discs), a bulge and a dark
halo, and fit the thin-disc component of the distribution function to the
solar-neighbourhood velocity distribution from the Geneva-Copenhagen Survey. We
find that the disc's vertical density profile is in good agreement with data at
z<~500 pc. The thick-disc component of the distribution function is then used
to extend the fit to data from Gilmore & Reid (1983) for z<~2.5 kpc. The
resulting model predicts excellent fits to the profile of the vertical velocity
dispersion \sigma_z(z) from the RAVE survey and to the distribution of v_\phi
velocity components at |z|~1kpc from the SDSS survey. The ability of this model
to predict successfully data that was not used in the fitting process suggests
that the adopted gravitational potential (which is close to a maximum-disc
potential) is close to the true one. We show that if another plausible
potential is used, the predicted values of \sigma_z are too large. The models
imply that in contrast to the thin disc, the thick disc has to be hotter
vertically than radially, a prediction that it will be possible to test in the
near future. When the model parameters are adjusted in an unconstrained manner,
there is a tendency to produce models that predict unexpected radial variations
in quantities such as scale height. This finding suggests that to constrain
these models adequately one needs data that extends significantly beyond the
solar cylinder. The models presented in this paper might prove useful to the
interpretation of data for external galaxies that has been taken with an
integral field unit.
