## How to specify Maximum Likelihood

For technical questions regarding estimation of single equations, systems, VARs, Factor analysis and State Space Models in EViews. General econometric questions and advice should go in the Econometric Discussions forum.

Moderators: EViews Gareth, EViews Moderator

cuongnh
Posts: 70
Joined: Thu Dec 11, 2008 10:09 am
Contact:

### How to specify Maximum Likelihood

Dear,
Could someone help me in how to specify for using maximum likelihood in Eviews? I dont understand how to define beta, alpha, scale in the specification. in the case of my analysis, I have series of prices of different commodities which are used as dependent variable and the remaining as independent ones.

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

### Re: How to specify Maximum Likelihood

You're going to have to be way more specific than that.

What is the likelihood function you're trying to maximise? What is the data you're trying to use? What are the parameters you're trying to estimate?

What is beta, alpha and scale?

cuongnh
Posts: 70
Joined: Thu Dec 11, 2008 10:09 am
Contact:

### Re: How to specify Maximum Likelihood

I would like to analyze the response of prices of rice on the changes in prices of crude oil (some dummies are included on the right hand side). Price data are daily basis, which is from Jul 2, 2007 to end of Mar, 2009. I am totally new to ML method, I am reading the User's Guide of Eviews to understand how to estimate using this method. I hope this method may help me to reduce the serial correlation in the results by using OLS.
As I read in the book, like below:
Parameter Names
In the example above, we used the coefficients C(1) to C(5) as names for our unknown parameters. More generally, any element of a named coefficient vector which appears in the specification will be treated as a parameter to be estimated.
In the conditional heteroskedasticity example, you might choose to use coefficients from three different coefficient vectors: one vector for the mean equation, one for the variance equation, and one for the variance parameters. You would first create three named coefficient vectors by the commands:
coef(3) beta
coef(1) scale
coef(1) alpha
You could then write the likelihood specification as:
@logl logl1
res = y - beta(1) - beta(2)*x - beta(3)*z
var = scale(1)*z^alpha(1)
logl1 = log(@dnorm(res/@sqrt(var))) - log(var)/2

I dont understand how to create coefficient vetors, and what "z" means in the specification.
Please explain me. Thank you very much!

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

### Re: How to specify Maximum Likelihood

beta, scale and alpha are coefficient vectors in the workfile. They're just vectors that store parameters.

You can create them, just as the manual says, by typing "coef(3) beta" in the EViews command window.

"Z", as mentioned in the manual, is a series in the workfile.

Perhaps before attempting to use the LogL object, it might be worth learning a little on maximum likelihood estimation (MLE) from an econometrics textbook. Learning MLE from reading the EViews manual is going to be tough.

cuongnh
Posts: 70
Joined: Thu Dec 11, 2008 10:09 am
Contact:

### Re: How to specify Maximum Likelihood

Thank you. In the textbook, z is define as a series in the workfile (where x, y, and z are the observed series (data)). in the example: y_t=b1+b2x_t+b3z_t+e_t, Let's say y is dependent variable, x, z are independent ones. But in the
series res = y - c(1) - c(2)*x - c(3)*z
series var = c(4) * z^c(5)
series logl1 = log(@dnorm(res/@sqrt(var))) - log(var)/2
"z" is treated in the var function. What is the difference between x and z. Since I have price of oil (independent variable) and dummy varibles, how can I define which is z?

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

### Re: How to specify Maximum Likelihood

The particular likelihood function that the example is estimating has the error term's variance as a function of Z (if you look at equation 32.1). Hence the LogL object has the variance as a function of Z.

cuongnh
Posts: 70
Joined: Thu Dec 11, 2008 10:09 am
Contact:

### Re: How to specify Maximum Likelihood

Dear Gareth, I am sorry for asking you too many times, I dont really understand.
In the equation (22.1), it mentions that, but I dont know why it is the function of Z, not X, while both X and Z are independent variables. I need to define exactly in the case of mine which is Z.

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

### Re: How to specify Maximum Likelihood

As I said above, I think you need to have a deeper understanding of MLE before you can understand how to estimate MLE in EViews.

I can't possibly tell you which variable should be "z". Do you even know if the particular likelihood function this specific example is estimating is the particular likelihood function you wish to estimate?

If the answer to that is "yes", then you (and only you) should already know which variable is "z".

cuongnh
Posts: 70
Joined: Thu Dec 11, 2008 10:09 am
Contact:

### Re: How to specify Maximum Likelihood

Thanks. I read to understand more MLE.

cuongnh
Posts: 70
Joined: Thu Dec 11, 2008 10:09 am
Contact:

### Re: How to specify Maximum Likelihood

Dear Gareth, I hope you are still with me. I tried to estimate using logl, but it popped up with this warning: Missing values in @logl series at current oeeficients at observation 1. The specification used to estimate is as follows:
@logl loglrice
res=price-beta(1)-beta(2)*poil-beta(3)*dricq-beta(4)*sdmep-beta(5)*sdvxb-beta(6)*dths
var = scale(1)*poil^alpha(1)
loglrice = log(@dnorm(res/@sqrt(var))) - log(var)/2
Could you please explain me this and how to solve this problem?

cuongnh
Posts: 70
Joined: Thu Dec 11, 2008 10:09 am
Contact:

### Re: How to specify Maximum Likelihood

Dear Friends, could any one help me this?
I tried to estimate using logl, but it popped up with this warning: Missing values in @logl series at current oeeficients at observation 1. The specification used to estimate is as follows:
@logl loglrice
res=price-beta(1)-beta(2)*poil-beta(3)*dricq-beta(4)*sdmep-beta(5)*sdvxb-beta(6)*dths
var = scale(1)*poil^alpha(1)
loglrice = log(@dnorm(res/@sqrt(var))) - log(var)/2
Could you please explain me this and how to solve this problem?

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: How to specify Maximum Likelihood

Looks like you are having an initial value problem. You should try different starting values for your coefficients, especially the ones that are used in the variance specification (i.e. scale and alpha). There have been numerous discussions on this issue, so you might want to do a simple search in the forum.

cuongnh
Posts: 70
Joined: Thu Dec 11, 2008 10:09 am
Contact:

### Re: How to specify Maximum Likelihood

trubador wrote:different starting values for your coefficients, especially the ones that are used in the variance specification (i.e. scale and alpha).

What do you mean by "starting value for your coefficients"?

Did you use forum search?
Posts: 1518
Joined: Thu Nov 20, 2008 12:04 pm

### Re: How to specify Maximum Likelihood

If you have not assigned any values to scale(1) and alpha(1), then EViews assumes 0 as their starting values, which can create problems in your variance equation. So it may be a good idea to supply different values, before running the estimation.

cuongnh
Posts: 70
Joined: Thu Dec 11, 2008 10:09 am
Contact:

### Re: How to specify Maximum Likelihood

I just changed the value "0" to "1" for both alpha and scale. It worked. But in the result sheet, the standard error, z-stats and probability are all not available (NA). WHat is the problem?