Between- and within-person level effects when using multilevel modelling for longitudinal data in R I’m using nlme package in R for analysing longitudinal data. The aim is to understand if changes in need satisfaction (TNS) and need frustration (TNF) predict changes in well-being (WBtot) over time (Tim) in participants (ID). The model with predictors:
model4 <- lme (WBtot~Tim + TNS +TNF, random = ~ Tim|ID, data = longit, method = "ML", na.action = "na.omit")

As I understand, the fixed effects in the output show how Tim, TNS and TNF are related to WBtot on each measurement occasion. My issue is I need to see between-person effects of TNS and TNF on WBtot (e.g., to see if individuals with higher TNS have greater WBtot) and within-person effects (e.g., would individuals have greater WBtot at time points when they have greater TNS?).
Can anyone advise how to look at between and within-person level effects of predictors in R?
 A: 
model4 <- lme (WBtot~RetTim + TNS +TNF, random = ~ Tim|ID, data = longit, method = "ML", na.action = "na.omit")

As I understand, the fixed effects in the output show how Tim, TNS and TNF are related to WBtot on each measurement occasion

Yes, although there is something strange in the model - I wonder if RetTim and Tim are the same variable ? Anyway, your the interpretation of the fixed effects is basically correct. Each estimate is the association between that variable and the outcome, with the other fixed effects remaining constant. When you fit random slopes (for example Tim in ~ Tim|ID) then you allow for the fixed effects of that variable to vary between subjects.

My issue is I need to see between-person effects of TNS and TNF on WBtot (e.g., to see if individuals with higher TNS have greater WBtot) and within-person effects.

One way to do this is to mean-centre the variables within groups/subjects/IDs and include the group means as level-2 predictors. So you would create new variables for the mean of each variable within each group and then subtract this from the individual level values, and then also include the mean of each group in the model along with the offseted variables.
lme(WBtot ~ RetTim.mean + RetTim.cent + TNS.mean + TNS.cent + NF.cent + TNF.mean, random = ~ Tim|ID)

The estimates for the centred variables will be within-subject and the estimates for the means will be between.
This is sometimes referred to as "contextual effects"
The other approach is to fit random effects for each of the fixed effects - so that each subject has their own slope (offset from the global fixed effect). However this assumes they are normally distributed and is probably not what you want here.
