Phylogenetic decorralation of an ordinal variable

From my PhD student Miri Mertner, I got a csv file with a collection of cultural anthropological variables from several hundred populations. She extracted this from D-Place.

All the variables covered, like political organization or crop type etc. are ordinal variables. She wants to use them as predictors of linguistic diversity.

The populations are non-independent due to common descent, I did a little study inferring two continuous latent variables for each observed variable. The first of these latent variables evolves according to Brownian motion along phylogenetic trees (which are inferred from language data). The second latent variable is iid. Jointly they predict the observed ordinal variables.

Here are the steps I carried out