BookmarkSubscribeRSS Feed
AgReseach7
Obsidian | Level 7

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;

4 REPLIES 4
PGStats
Opal | Level 21

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
SteveDenham
Jade | Level 19

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

mthorne
Obsidian | Level 7

How would you back transform values that were a result of dist=beta link=logit?

AgReseach7
Obsidian | Level 7

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;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is ANOVA?

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.

Discussion stats
  • 4 replies
  • 6766 views
  • 3 likes
  • 4 in conversation