Am I specifying my lmer model correctly? I've scoured Google and this site and I am still confused about the lmer function in the lme4 library.
I have some data collected from different psychiatric wards, which have a multilevel structure. To simplify, I'll pick two level 2 and two level 1 variables, although I actually have a few more.
Level 2- WardSize [this is the number of people on the ward] & WAS [this is a measure of how "nice" the ward is]
The grouping variable that tells R who's in which ward is called "Ward"
Level one- Gender [this is gender, obviously] & BSITotal [this is a measure of symptom severity]
Outcome is Selfreject, which again is what it sounds like.
I have this formula:
help=lmer(formula=Selfreject~WardSize+WAS+Gender+BSITotal+(1|Ward))
I'm hoping this means "each individual has a score related to their own Gender and symptom severity, and also a ward-level effect relating to the size of the ward and how "nice" it is"
Is this correct? The thing that's confusing me is that I can't see how R can tell which are level 1 and which level 2 variables, except for the ward level intercept given at the end.
If anyone could explain the notation so an idiot like me can understand that would be even better.
Many thanks!
 A: Your model specification is fine. 
The varying intercept for Ward, specified in lmer as you've done with (1 | Ward), is saying that subjects within each ward might be more similar to each other on Selfreject for reasons other than WardSize or Gender, so  you are controlling for between-ward heterogeneity.
You can think of the "1" as a column of 1s (i.e., a constant) in the data to which an intercept is fit. Usually the "1" is implied automatically in lm, for instance
lm(Y ~ X1 + X2)

actually specifies
lm(Y ~ 1 + X1 + X2)

Now that you have your basic model, you can start asking further questions like "Does the relationship between BSItotal and Selfreject differ between wards?"
lmer(formula=Selfreject ~ WardSize + WAS + Gender + BSITotal + (1 + BSITotal | Ward))

That is, both the intercept and the slope of BSITotal can differ between wards.
If you haven't picked it up yet, Gelman & Hill's Data Analysis Using Regression and Multilevel Model/Hierarchical Models is a great book that explains fitting models like this with lmer.
A: Here is a link to an explanation by Douglas Bates (who wrote lme4) as to why it's not necessary to specify the level for fixed effects.
