- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
simple issue driving me nuts!
I am trying to do a log-ratio transformation on a variable before regression. The variable is an index (so has values like 450, 560, 1200, etc.). i am doing this in the following way:
var1_T = log(var1/lag(var1))
I want to bring the transformed value to its original form. So wanted to do inverse log like:
var1_FCT_Orig = exp(var1_T);
Not working. Can anyone tell me where I am doing this wrong?
- Tags:
- log
- transformation
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When answers don't meet your assumptions, check your assumption.
EXP is the reverse of LOG.
So it gives you:
var1 / lag(var1)
If you want Var1 then you need to multiple by the lag of VAR1 as well.
var1_t = log(var1 / lag(var1) );
var1_fct_orig = exp(var1_t) * lag(var1);
The question is, do you have the lagged value to work with as well...
@eemrun wrote:simple issue driving me nuts!
I am trying to do a log-ratio transformation on a variable before regression. The variable is an index (so has values like 450, 560, 1200, etc.). i am doing this in the following way:
var1_T = log(var1/lag(var1))
I want to bring the transformed value to its original form. So wanted to do inverse log like:
var1_FCT_Orig = exp(var1_T);
Not working. Can anyone tell me where I am doing this wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
When answers don't meet your assumptions, check your assumption.
EXP is the reverse of LOG.
So it gives you:
var1 / lag(var1)
If you want Var1 then you need to multiple by the lag of VAR1 as well.
var1_t = log(var1 / lag(var1) );
var1_fct_orig = exp(var1_t) * lag(var1);
The question is, do you have the lagged value to work with as well...
@eemrun wrote:simple issue driving me nuts!
I am trying to do a log-ratio transformation on a variable before regression. The variable is an index (so has values like 450, 560, 1200, etc.). i am doing this in the following way:
var1_T = log(var1/lag(var1))
I want to bring the transformed value to its original form. So wanted to do inverse log like:
var1_FCT_Orig = exp(var1_T);
Not working. Can anyone tell me where I am doing this wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content
You have everything you need in the transformed series, except the starting value, Example:
title 'Logistic Growth Curve Model of U.S. Population';
data uspop;
input pop @@;
retain year 1780;
year=year+10;
logPopRatio = log(pop/lag(pop));
label pop='U.S. Population in Thousands';
datalines;
3929 5308 7239 9638 12866 17069 23191 31443 39818 50155
62947 75994 91972 105710 122775 131669 151325 179323 203211
226542 248710
;
data usNewPop;
set uspop;
retain lagNewPop;
if _n_ = 1
then NewPop = 3929;
else NewPop = exp(logPopRatio)*lagNewPop;
lagNewPop = NewPop;
drop lagNewPop;
run;
proc print; run;