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 PRINT; RUN; 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 PRINT; RUN;
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.
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
How would you back transform values that were a result of dist=beta link=logit?
how do you get beta (PROC GLIMMIX Beta distribution) back on original scale?
PROC glimMIX;
CLASS Phase TRT DAY ID;
MODEL DMIBWnew = TRT|phase /dist=beta DDFM=KR SOLUTION;
Random DAY/residual SUBJECT=ID;
LSmeans trt /DIFF ADJUST=SIMULATE (REPORT SEED=121211) cl adjdfe=row;
RUN; Quit;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.