# Preparing data for modelling

Often, the data structure used in modelling is relatively straightforward - one subject per row. In contrast, I am analysing service accessibility in a country and each region represents a row in data.

I have medical service offer data by county (total of 14) and year (total of 7). I need to report year and local population-adjusted estimates.

offer ~ year + population + (1 | county)


Would it be correct to use the following data format for such modelling?

Or is this a problem that every county has multiple rows in data? I have an option to prepare my data in different ways, for example, also by month. Preparing data in different ways gives me different number of rows, possibly leading to narrower confidence intervals. What other biases such data manipulations may cause? What is a good practice here?

## 1 Answer

Would it be correct to use the following data format for such modelling?

Yes, the model:

offer ~ year + population + (1 | county)


adjusts for the repeated measures within each county

Or is this a problem that every county has multiple rows in data?

No, that's precisely why we use a mixed model in such cases.

Preparing data in different ways gives me different number of rows, possibly leading to narrower confidence interval

I don't know what you mean by that. This is the format needed to fit a mixed model - one row per unit of measurement (country in this case)

What other biases such data manipulations may cause?

What other biases ? You haven't mentioned anything to do with bias and neither have I, because there is no bias due to the data format. As mentioned above you just need to prepare the data to have 1 row per unit of measurement. If you had repeated measures within subjects then you would need to have one row per subject.

What is a good practice here?

The only practice is to have one row per unit of measurement. At least, this is the case with every mixed model software that I have used.