# Random Effects, Linear Mixed Model with Partial Crossed Factors and Unbalanced Data

I am attempting to construct a Linear Mixed Effects Model with Partially Crossed Factors with repeated measures and replication.

Force was measured at the three locations on the foot (Toe vs Arch vs Heel) as subjects walked through a course in two different types of boots, over two types of terrain. The dataset is unbalanced (incomplete data for a few subjects).

The DV is peak force during each step, but this is tied to a factor (possibly a random effect) of Location of the measurement(@ the toe, arch, and heel). So for each step, there are three force measurements (DVs) corresponding the 3 locations on the foot. So there are repeated measures (on each subject) and replication (of each step).

For random effects I'm including the Subject ID (12 subjects) and each step they took (a total of 1455 steps from the 12 subjects). For a given step $i$:

$Step_i$, the three force values measured at the $Toe_i$, $Arch_i$, and $Heel_i$, are compared to one another (similar to a pair-wise comparison) but the variance between each step is not of interest.

Level 1 fixed effects include, gender (M vs F), footwear (Boot 1 vs Boot 2), leg (Dominant vs Non-Dominant), and terrain (smooth vs rocky).

Here is a sample of the data structure, for one combination of boot/terrain measurement on one leg of one subject. Step_No = 1 for Toe also corresponds to Step_No = 1 for Arch and Step_No = 1 for Heel. The force data has been normalized by it's mean, and transformed (Box Cox), though I read somewhere this is not appropriate for LMMs?

Force Subject Leg Terrain Gender Boot Location Step_No 0.215644547 S1 Dom Rocky F Boot_1 Toe 1 2.594064965 S1 Dom Rocky F Boot_1 Toe 2 -1.959028364 S1 Dom Rocky F Boot_1 Toe 3 -2.488808321 S1 Dom Rocky F Boot_1 Toe 4 -4.08184248 S1 Dom Rocky F Boot_1 Toe 5 -3.664827604 S1 Dom Rocky F Boot_1 Arch 1 -7.866304099 S1 Dom Rocky F Boot_1 Arch 2 0.636285727 S1 Dom Rocky F Boot_1 Arch 3 -2.810573171 S1 Dom Rocky F Boot_1 Arch 4 -2.105803967 S1 Dom Rocky F Boot_1 Arch 5 -7.894349142 S1 Dom Rocky F Boot_1 Heel 1 -17.60002905 S1 Dom Rocky F Boot_1 Heel 2 -12.20433197 S1 Dom Rocky F Boot_1 Heel 3 -8.534264312 S1 Dom Rocky F Boot_1 Heel 4 -13.75456182 S1 Dom Rocky F Boot_1 Heel 5

I have attempted setting up a linear model with the random effects using the following code in R, but the model fails to converge (see screenshot of errors generated below):

library(lme4) walk$Step_No <-factor(walk$Step_No) lme1 <-lmer(Force ~ (1 + Step_No*Location | Subject),data = walk, REML = F)

Any insight into how best to cross/nest these effects is greatly appreciated.