2022年9月13日星期二

2022年8月9日星期二

Counting number of duplicated cases by several variables

proc sort data=have(keep=key1 key2);
  by key1 key2;
run;
data want;
  do count=1 by 1 until(last.key2);
    set have;
    by key1 key2;
    end;
run;

2022年4月27日星期三

MLE and REML in mixed models

 In mixed models, if use MLE, we have to assume that fixed effects are known, rather than being estimated from the data.  If we use REML (residual maximum likelihood) it will automatically adjust for the degree of freedom corresponding to estimated fixed effects. This is the key difference between MLE and REML in mixed models,   however, the difference will be very small when the sample size is big.