[R-sig-ME] Convert SAS codes into R

Andrew Robinson A.Robinson at ms.unimelb.edu.au
Mon Oct 25 00:08:36 CEST 2010


Honestly, I don't think that this is a reasonable request.  That was
my initial reaction, but I wondered if I might just be being grumpy.
The long intervening silence implies that others think the same ... at
least some others ... 

So, Muhummad, apologies, but this is not a reasoanble request.  Good
luck finding a resolution elsewhere.

Andrew

On Fri, Oct 22, 2010 at 08:36:39PM -0700, Muhammad Yaseen wrote:
> Hi Dear,
> 
> I'd highly appreciate if someone can help me to convert these SAS
> codes into R. Thanks
> 
> 
> 
>  /*-------------------------------------------------------*/
>  /*---Data Set 11.5, Uniformity Trial                  ---*/
> data spatvar;
>    input rep bloc row col yield;
>    datalines;
> 1    4   1   1     10.5411
> 1    4   1   2      8.5806
> 1    2   1   3     11.2790
> ..........................
> ..........................
> ..........................
> 4   15   7   8     10.4298
> 4   14   8   5      7.3220
> 4   14   8   6     10.5104
> 4   15   8   7     12.6808
> 4   15   8   8     10.4482
> ;
>  /*-------------------------------------------------------*/
> 
>  /*-------------------------------------------------------*/
>  /*---Output 11.1                                      ---*/
> title 'no nugget - spherical covariance model';
> proc mixed data=spatvar;
>    model yield = ;
>    repeated / subject = intercept
>               type    = sp(sph)(row col);
>    parms (0 to 10 by 2.5)
>          (1 to 10 by 3  );
>    ods select ParmSearch CovParms IterHistory
>               ConvergenceStatus FitStatistics LRT;
> run;
>  /*-------------------------------------------------------*/
>  /*-------------------------------------------------------*/
>  /*---Output 11.2                                      ---*/
> title 'no nugget - exponential covariance model';
> proc mixed data=spatvar;
>    model yield = ;
>    repeated / subject = intercept
>               type    = sp(exp)(row col);
>    parms (0 to 10 by 2.5)
>          (1 to 10 by 3  );
>    ods select CovParms FitStatistics;
> run;
> proc mixed data=spatvar;
>    model yield = ;
>    repeated / subject = intercept
>               type    = sp(gau)(row col);
>    parms (0 to 10 by 2.5)
>          (1 to 10 by 3  );
>    ods select CovParms FitStatistics;
> run;
>  /*-------------------------------------------------------*/
>  /*-------------------------------------------------------*/
>  /*---Output 11.3                                      ---*/
> title 'rcb error model';
> proc mixed data=spatvar;
>    class rep;
>    model yield = ;
>    random rep;
>    ods select CovParms FitStatistics;
> run;
> 
> title 'incomplete block error model';
> proc mixed data=spatvar;
>    class bloc;
>    model yield = ;
>    random bloc;
>    ods select CovParms FitStatistics;
> run;
>  /*-------------------------------------------------------*/
>  /*-------------------------------------------------------*/
>  /*---Outpuyt 11.4 a                                   ---*/
> title 'nugget effect - exponential covariance model';
> proc mixed data=spatvar;
>    model yield = ;
>    repeated / subject = intercept
>               type    = sp(exp)(row col)
>               local;
>    parms (0    to 10    by 2.5 )
>          (1    to 10    by 3   )
>          (0.05 to  1.05 by 0.25);
>    ods select IterHistory ConvergenceStatus CovParms;
> run;
>  /*-------------------------------------------------------*/
>  /*-------------------------------------------------------*/
>  /*---Outpuyt 11.4 b                                   ---*/
> title 'nugget effect - exponential covariance model';
> proc mixed data=spatvar convg=1e-7;
>    model yield = ;
>    repeated / subject = intercept
>               type    = sp(exp)(row col)
>               local;
>    parms (0    to 10    by 2.5 )
>          (1    to 10    by 3   )
>          (0.05 to  1.05 by 0.25);
>    ods select IterHistory ConvergenceStatus CovParms;
> run;
>  /*-------------------------------------------------------*/
>  /*-------------------------------------------------------*/
>  /*---Output 11.5                                      ---*/
> data spatvar; set spatvar;
>   obs = _n_;
> run;
> proc mixed data=spatvar convg=1e-7;
>    class obs;
>    model yield = ;
>    random obs / type=sp(exp)(row col);
>    parms (0    to 10   by 2.5 )
>          (1    to 10   by 3   )
>          (0.05 to 1.05 by 0.25);
>    ods select Dimensions IterHistory ConvergenceStatus
>               FitStatistics CovParms;
> run;
>  /*-------------------------------------------------------*/
> 
> --
> 
> Muhammad Yaseen
> 
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

-- 
Andrew Robinson  
Program Manager, ACERA 
Department of Mathematics and Statistics            Tel: +61-3-8344-6410
University of Melbourne, VIC 3010 Australia               (prefer email)
http://www.ms.unimelb.edu.au/~andrewpr              Fax: +61-3-8344-4599
http://www.acera.unimelb.edu.au/




More information about the R-sig-mixed-models mailing list