  Aims. We aim at creating a Bayesian model to infer the coefficients of PL or
PLZ relations that propagates uncertainties in the observables in a rigorous
and well founded way. Methods. We propose a directed acyclic graph to encode
the conditional probabilities of the inference model that will allow us to
infer probability distributions for the PL and PL(Z) relations. We evaluate the
model with several semi-synthetic data sets and apply it to a sample of 200
fundamental mode and first overtone mode RR Lyrae stars for which Gaia DR1
parallaxes and literature Ks-band mean magnitudes are available. We define and
test several hyperprior probabilities to verify their adequacy and check the
sensitivity of the solution with respect to the prior choice. Results. The main
conclusion of this work is the absolute necessity of incorporating the existing
correlations between the observed variables (periods, metallicities and
parallaxes) in the form of model priors in order to avoid systematically biased
results, especially in the case of non-negligible uncertainties in the
parallaxes. The tests with the semi-synthetic data based on the data set used
in Gaia Collaboration et al. (2017) reveal the significant impact that the
existing correlations between parallax, metallicity and periods have on the
inferred parameters. The relation coefficients obtained here have been
superseded by those presented in Muraveva et al. (2018a), that incorporates the
findings of this work and the more recent Gaia DR2 measurements.
