LSD in R for mix model

#1
Hello,

I am analyzing agricultural trial data pooled from different locations (same treatment list over different sites). I was advised to build my data model as below when pooling same treatment response (e.g., yield) from different site:

1575489643750.png

To do the mean separation test I was told to calculate the LSD using df and MSE from the interaction term (Location*Treatment).

I wonder does anyone here know the R code to develop the mix model above and run the LSD test using interaction term df and MSE?

Many thanks!!