Probit Model Code / Inflection Point

For questions regarding programming in the EViews programming language.

Moderators: EViews Gareth, EViews Moderator, EViews Jason, EViews Matt

diggetybo
Posts: 152
Joined: Mon Jun 23, 2014 12:04 am

Probit Model Code / Inflection Point

Postby diggetybo » Wed Nov 11, 2015 10:13 am

Hello,

I just have 2 stand alone questions about Probit modeling/ scenarios.

1. I like the probit create scenario, override variable user interface, but now that I'm familiar with it, I'm aiming to streamline things and write a program. My eviews 9 command capture log usually helps me figure out what I need to do, however it didn't have any log of what was going on behind the scenes when I was pointing and clicking in my probit model. Basically what I'd like to code is a program that can create a model from an existing probit equation and be able to create 2 scenarios and solve them, then form a group then plot the response probability curve (the graphing part is straightforward). So how feasible is this?

2. Once I have my desired predicted y values, is there anything built in or a relevant programming code to solve for the inflection point of the probit curve? So I can see where the diminishing effects start to kick in (as opposed to eyeballing it, or dusting off my calculus books).

Thanks for reading

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

Re: Probit Model Code / Inflection Point

Postby EViews Glenn » Wed Nov 11, 2015 7:20 pm

1. should be easy. Start with the equation proc makemodel.

2. Not sure what you mean by inflection point. The mode of the derivative function is the standard normal density, which of course has a max at 0. So ignoring explanatory variables, you just have to offset by the estimate of the intercept. But again, I'm not certain that's what you want.

diggetybo
Posts: 152
Joined: Mon Jun 23, 2014 12:04 am

Re: Probit Model Code / Inflection Point

Postby diggetybo » Wed Nov 11, 2015 10:06 pm

Thanks for the quick reply. Let me elaborate briefly:

1. You're right the point and click method of creating probit model scenarios gets the job done. proc-->make model-->scenario, ect. However my question was more on if there is any eviews code equivalent so that I can automate this procedure to some degree. In other words, using strictly code, can I create a program that evaluates an existing probit equation that can solve up to 2 alternate scenarios? (I tried using Eviews 9 command capture log, but it didn't keep track of this).

2. I don't know if there is another name for this, but basically it is the point where the slope of the curve changes. When evaluaing, say, a return to education model, OLS assumes constant returns, as you know. Whereas nonlinear models like probit are curved in shape, and there is a point where returns go from increasing to diminishing, I assumed this point is called the inflection point, but regardless of the jargon, is there anything eviews can do to make my life easier when calculating it? Of course I can plot it and see it visually if it's just 1 model, but imagine if I had many, many probit models and many inflection points to solve for, I'd be better off using scalars or a vector that keeps track of them all.

Thanks again

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

Re: Probit Model Code / Inflection Point

Postby EViews Gareth » Wed Nov 11, 2015 10:18 pm


diggetybo
Posts: 152
Joined: Mon Jun 23, 2014 12:04 am

Re: Probit Model Code / Inflection Point

Postby diggetybo » Thu Nov 12, 2015 1:37 am

As always, your links are lifesavers. In the object reference there is everything from the eq.make model command to overrides and scenarios. I'm about 90% finished coding the whole procedure.

My only remaining question is about the solve function.

Code: Select all

solve mod01
Can solve the model, but I didn't see anything in the object reference about configuring what is the active scenario and what is the alternate scenario. Solve options only seemed to configure iterative procedures or include/exclude structural elements.

For reference I have my scenarios already created by using

Code: Select all

mod01.scenario(n) "s1" mod01.scenario(n) "s2"
I already have generated overriding series for each scenario, so how can I tell the solve function to solve the model with s1 as the active scenario and s2 as the alternate? (resulting in two series of solutions, y_1, y_2)

Thanks

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

Re: Probit Model Code / Inflection Point

Postby EViews Gareth » Thu Nov 12, 2015 7:05 am

Model.scenario has options for setting which scenario is active/alternate

diggetybo
Posts: 152
Joined: Mon Jun 23, 2014 12:04 am

Re: Probit Model Code / Inflection Point

Postby diggetybo » Thu Nov 12, 2015 7:57 am

Oh right, I was thrown off by using the word comparison instead of alternate. So that's one step closer, I now have:

Code: Select all

mod01.scenario(c) "s2"
So my alternate scenario has been configured, but I, honestly, could not find anything about solving for both solutions when toggling the solve function. Each time my program only solves for one. Eviews generates only 1 series: y_2, so I'm inferring only the second scenario was solved for. Any ideas on how to solve for both? (just as if I were to check the "solve for alternate along with active" box in the user interface)

Thanks for everything

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

Re: Probit Model Code / Inflection Point

Postby EViews Gareth » Thu Nov 12, 2015 8:07 am


diggetybo
Posts: 152
Joined: Mon Jun 23, 2014 12:04 am

Re: Probit Model Code / Inflection Point

Postby diggetybo » Thu Nov 12, 2015 8:24 am

I have tried everything on that page earlier today, and again just now, I'll just post the one I felt held the most promise, the dynamic solution argument:

Code: Select all

solve(d) mod01
However this syntax as well only yielded one solution series. I have coded: mod01.scenario(n) "s1" and mod01.scenario(c) "s2" before it reaches the line containing solve. Hopefully there is no user error to this extent.

Again, I'm not sure how "solve for alternate along with active" is worded in terms of specifying options for the solve function, and that page, though helpful, is a little hard to follow if you're only familiar with the user interface. Please elucidate just a little more, thank you.

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

Re: Probit Model Code / Inflection Point

Postby EViews Gareth » Thu Nov 12, 2015 8:35 am

a=t

diggetybo
Posts: 152
Joined: Mon Jun 23, 2014 12:04 am

Re: Probit Model Code / Inflection Point

Postby diggetybo » Thu Nov 12, 2015 8:37 am

Boy, do I feel stupid. Your patience is much appreciated. I successfully coded the entire make model, solve procedure :)

I'm sure everyone has more important things to do, but when you get around to it, consider the inflection point again. (last question, I swear)

http://www.eviews.com/help/helpintro.ht ... 064.3.html

Here there is information on the second derivative. And I just brushed up on calculus, and I remembered that the inflection point of a non-linear function occurs where the second derivative changes signs. So that lends some hope to eviews having a built in procedure for computing the second derivative.

My goal is after I compute the desired probability response curve (from the eviews model/scenarios as discussed in the above comments) I want to plot a vertical line at x=? where ? = the value of x for the inflection point, or the exact value where x changes signs in the second derivative -- or equivalently where the first derivative has an extreme. Either way should result in a single value for x given y_1 or y_2 (which we generated by solving scenarios).

The above link only talked about the theoretical premise. Is there anything more hands-on? Or if someone knows off the top of their head, can eviews truly do this, if so, how?

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

Re: Probit Model Code / Inflection Point

Postby EViews Glenn » Thu Nov 12, 2015 12:09 pm

I think you are overthinking this. The derivative of the probit probability is the standard normal density. This density has a peak at 0. In a probit model we typically offset with an intercept, so as I suggested above, for evaluating with explanatory variables set to zero, you just want the intercept. Alternately, if you have explanatory variables that are non-zero, you'll want XB.


Return to “Programming”

Who is online

Users browsing this forum: No registered users and 2 guests