Hi All, I'm running multiple versions of a model through the %MACRO below. I want to specify an AR(1) (or ARMA 1,1) for the R matrix and produce estimates of the in-group mixed effect estimates (in other words, the group-specific coefficients). The program runs fine when the REPEATED statement is not used, but the marginal Var-Covar matrix does not appear to have the correct form. I've seen many examples of using RANDOM and REPEATED together to produce an AR(1) Covariance structure, but none with the ESTIMATE function being run -- Am I doing something wrong, misunderstanding how RANDOM and/or REPEATED interact?? %macro ME_Estimate(InDat, FEtab, REtable, groupvar, FE, RE); %local i; %let nRE = %sysfunc(countw(&RE.)); DATA temp; set &InDat.; RUN; PROC SQL noprint; SELECT DISTINCT &GROUPVAR. INTO :GRP_LIST separated by " " FROM temp; SELECT COUNT(DISTINCT CITY) INTO :N_grp FROM temp; QUIT; PROC MIXED data= &InDat.; class &groupvar. qtr; MODEL response = &FE. / DDFM=KR Solution; RANDOM &RE. / TYPE=ARMA(1,1) subject=&groupvar. Solution; REPEATED qtr / TYPE=ARMA(1,1) subject=&groupvar.; * HERE IS THE PROBLEM ; %DO i = 1 %TO &N_grp; %LET CURR_GRP =%SCAN(&GRP_LIST,&I.); %DO tests = 1 %TO &nRE.; %LET CURR_RE = %SCAN(&RE., &tests.); ESTIMATE "&CURR_RE._&CURR_GRP." &CURR_RE. 1 | &CURR_RE. 1 / subject %est_Zeroes(&i.); %END; %END; ods output SolutionF = &FEtab. SolutionR = REdeviate estimates = &REtable.; RUN; PROC DATASETS noprint; DELETE TEMP; RUN; %mend; I then call the macro with something like: %let FEvars1 = Var1 Var2 Var3; %let REvars1_1 = Var1; %ME_Estimate(InDat=V&V._ALL(where=(qtr >= '1JAN1987'd)), FEtab = FEout1_1, REtable= REout1_1, groupvar=GRP1, FE = &FEvars1., RE = &REvars1_1.); And the Est_Zeroes macro is simply: %macro est_Zeroes(numzeroes); %local i; %do i = 1 %to %eval(&numzeroes-1); 0 %end; 1; %mend; As I said, it works fine without the REPEATED statement. When I include REPEATED the Std Errors and/or the estimates from the Random Effects Solutions are zero!! I'm not sure what's going on.
... View more