How do I do a Box-Cox Transformation?

For questions regarding the import, export and manipulation of data in EViews, including graphing and basic statistics.

Moderators: EViews Gareth, EViews Steve, EViews Jason, EViews Moderator, EViews Pamela

Posts: 5
Joined: Wed Oct 03, 2012 6:29 am

How do I do a Box-Cox Transformation?

Postby JohnYork » Mon Aug 19, 2013 3:29 am

I am using E-Views 7.

I wish to compare the results for Linear and Non-Linear Equations (the latter having different dependent variables due to the use of logs).

I've been told I need to do a 'Box-Cox' transformation of my data but can only find one reference to Box-Cox transformations in the User Manual (in Data Graphing).

How then do I apply a Box-Cox transformation to my data in E-Views so that I can get comparable r-squareds etc.


EViews Gareth
Fe ddaethom, fe welon, fe amcangyfrifon
Posts: 11765
Joined: Tue Sep 16, 2008 5:38 pm

Re: How do I do a Box-Cox Transformation?

Postby EViews Gareth » Mon Aug 19, 2013 7:37 am

Code: Select all

series y_boxcox = (y^a-1)/a

Where Y is the series you're transforming, and a is the Box-Cox parameter.
Follow us on Twitter @IHSEViews

EViews Glenn
EViews Developer
Posts: 2590
Joined: Wed Oct 15, 2008 9:17 am

Re: How do I do a Box-Cox Transformation?

Postby EViews Glenn » Mon Aug 19, 2013 9:59 am

...and of course

Code: Select all

series y=log(y)

if a=0 (Gareth only handles the difficult cases :))

If you are not sure whether a is zero at the onset of the command and don't want to have to test and then switch between the two formulations, you could use @recode.

Code: Select all

series y_boxcox=@recode(a=0, log(y), (y^a-1)/a)

Posts: 7
Joined: Wed Jun 21, 2017 3:33 pm

Re: How do I do a Box-Cox Transformation?

Postby CherifEViews » Sun Jul 09, 2017 8:14 am

It's possible to estimate the best value of lamda Box-Cox transformation with "use Spitzer(1982) algorithm diriving from L(lamda)".
First, compute the geometric mean of Y(t), with Y(t)<>0.

Code: Select all

series gm=@gmean(Y)

Second, scale Yt by its geometric mean:

Code: Select all

series z=y/gm

third, the “trick” simplifies L(λ) considerably. Ignoring constant terms, L(lamda)...
my question is: How can estimate the best lamda value with Spitzer(1982) algorithm or via simple program, honestly i have a difficulty to interpret the third step by LogL.
Could someone help me.
Best Cherif.
Box-Cox_step 2 & 3.png
Box-Cox_step 2 & 3.png (53.33 KiB) Viewed 1942 times
Box-Cox_step 1.png
Box-Cox_step 1.png (50.12 KiB) Viewed 1942 times

Return to “Data Manipulation”

Who is online

Users browsing this forum: No registered users and 4 guests