Thank you very much for your help. I was thinking about your explanations.
> There are N_f farms. For each farm, there is a
> measure of its thermal environment HLI. HLI is
> continuous. There is one value of HLI per farm. There
> are N_a animals at each farm. In total, there are
> N_f*N_a animals. The individual animal ID is unique.
> In total, there are N_f*N_a unique IDs in the data
> set. Animals at each farm are of two genotypes. The
> respiration rate mean_rr is an outcome. It is
> measured (observed) once for each animal. In total,
> there are N_f*N_a observations in the data set.
The outcome (respiration rate) has not been measured once for each animal, but there are 9 replicates at best (missing values) as data arise from 9 observation days. That's why I assumed a random coefficient type of model would be useful as it would fit random regression models for each animal instead of using a repeated measures analysis (since I am not interested in the time effect; a suggestion in:
http://www2.sas.com/proceedings/forum2007/178-2007.pdf
The number of animals N_a is not equal across farms N_f, but at each farm there is an equal number of the two genotypes (2x2, 5x5, 6x6..).
Does it make any difference?
> The HLI is measured at the farm level. ***If HLI is
> different for all N_f farms (there are N_f distinct
> values of HLI)***, then HLI and farm are confounded
> thus no random farm effect should be specified.
>
> Assuming the *** statement is correct, we fit the
> following model to test if slopes for HLI are the
> same between the two genotypes:
>
> proc mixed data=x;
> class genotype;
> model mean_rr = genotype HLI genotype*HLI /solution;
> run;
>
> Or, in Proc GLM:
>
> proc glm data=x;
> class genotype;
> model mean_rr = genotype HLI genotype*HLI;
> run;
Your *** statement is correct.
I tried the simple analysis of covariance without using any random effects at all:
proc mixed data=x;
class genotype;
model mean_rr = genotype HLI genotype*HLI /solution;
run;
Again, only type I tests of fixed effects show a distinct genotype effect as it is obvious from the scatter-plots, but default type III tests do not.
> There is no random coefficient for HLI. HLI is a
> covariate in your problem, a continuous variable we
> adjust for (analysis of covariance chapter in "SAS
> System For Mixed Models"). Moreover, if only main
> effect for HLI was included in the model it would
> have no effect on significance testing of genotype as
> genotype is the animal level effect thus within
> subject variance (unaffected by having only main
> effect for HLI) is used in test of significance.
>
> UPD. Now, suppose the observed HLI levels came from
> the population of the HLI levels (HLI is random). We
> can fit such model as follows:
>
> proc mixed data=x;
> class genotype;
> model mean_rr = genotype /solution;
> random HLI genotype*HLI;
> run;
This approach results in estimates=0 for the random effect genotype*HLI (using the solution option).
Your approach assuming HLI to be continuous and to represent the population of HLI levels (which is appropriate) is fine, but it doesn't allow me to show the increase in respiration rate with increasing HLI, depending on the genotype (genotype*HLI in the fixed effects part of the model), the different slopes, respectively. This is what is most interesting when looking at the plots.