# How to check the linearity of continuous variable in linear mixed model

I'm doing a linear mixed model using lme.

In my adjustement factors, I have a continuous varaible (named X1). And I want to check the linearity of this variable using a spline function or a fractional polynomial but I don't succeed.

Can someone help me ? How to do that ?

Ex with spline :

lme(Y ~ T + X + pspline(X1, 4), data = df, random = ~ T | SUBJECT )


But then, I don't know how to conclude for the linearity.

library("splines")