Help with setup of a hierarchical linear model (lmer) in R, selection of fixed and random effects I have calculated a particular parameter y in each subject our of 3 studies (each 15-30 subjects). In study #3, the subjects have been measured twice (with 2 different treatments, M and P), and therefore I calculated this variable twice for those subjects. Subjects of the other two studies didn't get any treatment (therefore Treatment = NA), and the treatment is not important to me.
I want to predict an overall significant difference of this parameter y from zero. Therefore, I was told to use HLM/MLM because this data is hierarchical because of the 2 treatments in study #3.
So my idea is to model something like:
y ~ Study + Subject + Treatment

As far as I understood, I want to look at the intercept of the model, to know if the parameter is statistically significant different from zero. I am not interested in the effect of Treatment, or Study, however.
Which of those parameters of the model should I now treat as fixed or random effect? And do I need to mean-center some variable to be able to interpret the intercept correctly?
Any help in a direction would be highly appreciated.
Thanks so much!
 A: Welcome to the site, roman. I would suggest filtering out the individuals who were not in study #3. Assuming that study is coded 1, 2, or 3, I would first narrow down your data to just those subjects in study 3. You can use dplyr for this:
require(dplyr)
study3 <- original.data %>% filter(study==3) 

Now that you have a data frame with only study 3 participants, you can run your model. You should code your treatment variable such that one or the other treatments is 0 and the other is 1. If you coded treatment such that M==0 and P==1, and ran the following model:
require(lme4)
m <- lmer(y ~ 1 + Treatment + (1|Subject), data=study3) 
summary(m)

This will give you two fixed effect coefficients, the intercept, which is the mean value of y in Treatment==0 and Treatment, the difference in the mean value of y for Treatment==1 relative to Treatment==0. You will also get a random effect estimate for Subject and the residual. Respectively, these tell you the variance in y that is between Subjects and within Subjects. 
It is unclear to me why you want to know the mean of y irrespective of the treatment. However, you could get this by estimating a so-called "empty" model that ignores the effect of treatment:
emptym <- lmer(y ~ 1 + (1|Subject), data=study3) 

Here the fixed intercept gives you the mean value of y, while accounting for the correlation in y that is due to repeated measures of subjects. This will be slightly different than the mean you get from mean(study3$y).
Edit: Based on roman's desire to include participants from all 3 studies, one suggestion would be to recode treatment to be 0, 1, or 2, corresponding to the NA condition in studies 1 and 2, and the M and P conditions in study 3.
library(dplyr)
original.data <- original.data %>% replace_na(treatment=0) #change treatment=NA to treatment=0

Make sure that the treatment variable is a factor variable (original.data$treatment <- as.factor(original.data$treatment). Then you can run your model with treatment and study as fixed effect predictors. 
m1 <- lmer(y ~ treatment + study + (1|Subject), data=original.data)

If you get any weird warnings about this, it could be because treatment and study are highly collinear and you may want to just include treatment as your fixed effect covariate. 
