3 levels model with random slope in R I'd like to estimate a 3 level model (years clustered in districts clustered in counties) on  the Leyland data (Mortality in England and Wales, 1979-1992 An Introduction to Multilevel Modelling using MlwiN) using R.
I have 3 predictors (year79 (at level 1), year792 (at level 1), and family(at level 2)).
year792 is just the square of year79.
I'd like to vary the slope of year between units at the third level (county).
I used the following code but I'm not sure it is correct:
fit7<-lmer(smr ~ year79 + year792 + family + (1 |county/district ) + (year79 |county), data=Imdp, REML=FALSE)

 A: I think you overlooked that (1 | county/district) and (year79 | county), which is the same as ( 1 + year79 | county) both specify a random intercept for county.
Try this instead:
fit <- lmer(smr ~ year79 + year792 + family +
                  (1 | county/district) + (0 + year79 | county),
            data=Imdp, REML=FALSE)

This fits a random effects model, with fixed effects for year79, year792, and family. As random effects, there are intercepts for each county and each interaction between county and district (1 | county/district expands to (1 | county) + (1 | county:district), reflecting that each district is nested within one of several counties. As a further random effects, the slope of year79 is allowed to vary per county. It is assumed that the random slope of year79 per county and the intercept per county are not correlated.
The thing to bear in mind is, that, given the data, other models are also possible. I think it helps to spell out and describe in detail a model, and then compare if this is actually what you want.
If you really, as you write, only want to allow the slopes of year79 to vary by county, with no individual intercept per county, than this would be specified as followed:
fit2 <- lmer(smr ~ year89 + year792 + family + (0 + year79 | county),
             data = Imdp, REML=FALSE)

However, it will almost always make sense to include a random intercept as well, both from a data viewpoint and from a model testing viewpoint.
