Programming the statistical procedures from SAS

Proc Glimmix data transform and backtransform

Reply
Contributor
Posts: 40

Proc Glimmix data transform and backtransform

How is data transformed in Glimmix for asin (& backtransformed) like the following code for lognormal transformation?

How about in Proc Mixed?
I need to asin transform data in both Mixed & Glimmix. Just don't know the best way to backtransform vs. just transforming the means, SE, etc..., but have been told not to do that.

 

 

PROC GLIMMIX;

CLASS ID TRT DAY;

MODEL CPK = TRT day trt*day/dist=lognormal ddfm=kr solution;

Random day /residual subject = ID(trt) type =CSH;

LSMEANS TRT day/DIFF ADJUST=simulate;

LSmeans trt*day/slicediff=day adjust=SIMULATE adjdfe=row;

ODS OUTPUT lsmeans=lsmeans;

PROC PRINTRUN; quit;

 

data btlsmeans;

set lsmeans;

omega=exp(stderr*stderr);

btlsmean=exp(estimate)*sqrt(omega);

btvar=exp(2*estimate)*omega*(omega-1);

btsem=sqrt(btvar);

PROC PRINTRUN;

Respected Advisor
Posts: 4,814

Re: Proc Glimmix data transform and backtransform

[ Edited ]

If transformation is your only option, you must transform your data prior to calling glimmix. And back transform estimates and confidence limits (but not SEs) after.

 

For example:

 

data test;
call streamInit(767);
do i = 1 to 100;
    proportion = rand("uniform");
    output;
    end;
run;

data trans;
set test;
proportionTrans = arsin(sqrt(proportion));
run;

title "Untransformed";
proc glimmix data=trans;
model proportion=/s cl;
run;

title "Transformed";
proc glimmix data=trans;
model proportionTrans=/s cl;
ods output ParameterEstimates=transPE;
run;

title "Back-transformed";
proc sql;
select
    sin(estimate)**2 as Estimate,
    Alpha,
    sin(lower)**2 as Lower,
    sin(upper)**2 as Upper
from transPE
where effect="Intercept";
quit;

Depending on the nature of your data, I would suggest to investigate using other statistical models before resorting to the arcsin transform.

 

Note, when using the lognormal distribution in glimmix, use the ilink option to get estimates on the original scale.

PG
Respected Advisor
Posts: 2,655

Re: Proc Glimmix data transform and backtransform

First of all, the arcsin(sqrt) transformation is only an approximation to the canonical link function for binomially distributed variables (logit).  So, if you are using GLIMMIX, don't bother with the arcsin approximation. Analyze the data without pretransforming, but use the DIST=BINOMIAL option in the MODEL statement.  You can then get all of the material on both the linked and original scale, including standard errors and confidence bounds.

 

For lognormally distributed data, it is a bit more complicated.  It is more than just log transforming the data.  Lognormal data is such that the logs of the value are normally distributed with a separable error term.  Just applying a log link in GLIMMIX assumes that not only are the log(values) normally distributed, but that the errors are multiplicative.  As a result, using the ILINK operator for DIST=LOGNORMAL does not return values on the original scale.  You will need to backtransform to get on the original scale, recalling that the mean of the lognormal distribution is not just the exponentiated value.

 

Steve Denham

Ask a Question
Discussion stats
  • 2 replies
  • 491 views
  • 3 likes
  • 3 in conversation