We describe a Bayesian method, for fitting curves to data drawn from an exp
onential family, that uses splines for which the number and locations of kn
ots are free parameters. The method uses reversible-jump Markov chain Monte
Carlo to change the knot configurations and a locality heuristic to speed
up mixing. For nonnormal models, we approximate the integrated likelihood r
atios needed to compute acceptance probabilities by using the Bayesian info
rmation criterion, BIC, under priors that make this approximation accurate.
Our technique is based on a marginalised chain on the knot number and loca
tions, but we provide methods for inference about the regression coefficien
ts, and functions of them, in both normal and nonnormal models. Simulation
results suggest that the method performs well, and we illustrate the method
in two neuroscience applications.