Hi,
I just started with EViews 8. I tried to import a small .xlsx file but it wouldn’t read. The .xlsx file was generated by MS Access in case that matters. I converted to .xls in Excel and then it reads fine. Not a big deal, but let me know if there’s a way to get .xlsx files to read.
Next I ran a logistic regression on my two series g and x using
logit g c x
which returned the right values for the coefficients. Is there an easy way to plot the estimated continuous probability model for g as a function of x, i.e. the logistic function with parameter (c0 + x*c1) where c0 and c1 are the estimated parameters? It’s easy to get a plot of the estimated probability as a function of the values of the samples of x in my data series but I can’t figure out how to get it as a function of x itself without generating the plot manually.
Any help greatly appreciated!
Import and plotting
Moderators: EViews Gareth, EViews Steve, EViews Moderator, EViews Jason
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Import and plotting
How many observations do you have? If you have a lot there are a couple of not-to-difficult ways of doing this. If there are few, it requires a bit, but not too much, more work.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Import and plotting
With regards to getting the .xlsx file in - how did you try to do it?
Re: Import and plotting
Glenn and Gareth,
Thanks for the quick response. For this first case I only have 22 observations. But after I get a few small cases to work I'll jump to my real sequences which contain thousands of observations. So, ideally, I'd like to figure out how to process both small and large data sets.
As for the .xlsx file, I tried the Open Foreign Data command. It hung on the small (22 row) .xlsx file, but after converting to the old .xls format it read in using the same command without incident.
Thanks for the quick response. For this first case I only have 22 observations. But after I get a few small cases to work I'll jump to my real sequences which contain thousands of observations. So, ideally, I'd like to figure out how to process both small and large data sets.
As for the .xlsx file, I tried the Open Foreign Data command. It hung on the small (22 row) .xlsx file, but after converting to the old .xls format it read in using the same command without incident.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Import and plotting
Could you provide the .xlsx file? It should have worked.
Re: Import and plotting
Yes, I can provide the .xlsx file. I'm not at my EViews computer so it will be a few hours before I can do this. If I want to email the file will support@eviews.com work?
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Import and plotting
Sure.
-
EViews Gareth
- Fe ddaethom, fe welon, fe amcangyfrifon
- Posts: 13604
- Joined: Tue Sep 16, 2008 5:38 pm
Re: Import and plotting
File received, and was able to open without any problems. Are you certain you tried Open->Foreign Data As Workfile?
Re: Import and plotting
Yes, with EViews 8 under Windows 8. Thanks for checking and sorry that you can’t duplicate. Converting to .xls is an easy enough workaround.
Also, I’m still unable to easily solve the plotting quandary so any help there would be most appreciated.
Also, I’m still unable to easily solve the plotting quandary so any help there would be most appreciated.
-
EViews Glenn
- EViews Developer
- Posts: 2682
- Joined: Wed Oct 15, 2008 9:17 am
Re: Import and plotting
Here's an example.
Note that EViews is set up to display graphs of data in a workfile, not of general functions. with so few observations, you'll have to set of a fake workfile to get nice smooth pictures. It's not that hard, but does require a bit of effort.
The first part of the example generates some data and fits a logit.
Presumably, you've run something like the above, which estimates a named logit equation. Note that my dependent variable is called Y and my regressor is Z and that they are located in a workfile page ABC.
What we're going to do is to create a new page with a different set of Z, copy the equation into this page and forecast using the different set of Z. Note that if you had a lot of observations in your page, you could backup the existing Z, modify the values, forecast, and restore the Z without doing so in a different workfile (even better would be to use the model object to do this, but that requires a bit of tooling up on the concept of scenarios, which is probably overkill for your simple task).
You can do this interactively, but here is a command version of this process:
I create a new page named DEF with 500 observations, and populate it with two series, a fake dependent and Z. I used the @trend to fill Z with values 0 to 499, and then do a bit of math to recenter and rescale. You may need to modify the centering and scaling a bit to get the best looking graph.
Next, I copy the original equation from the first page to the new page, and use it to forecast (fit the probabilities). The remainder of the commands plot the series, copy the frozen graph back into the original page, and delete the new page.
Note that EViews is set up to display graphs of data in a workfile, not of general functions. with so few observations, you'll have to set of a fake workfile to get nice smooth pictures. It's not that hard, but does require a bit of effort.
The first part of the example generates some data and fits a logit.
Code: Select all
wfcreate(page=abc) u 1 100
series z = 3*nrnd
series xb = -3 + z *4
series ystar = xb + 3*nrnd
series y = ystar > 0
equation eq1.logit y c z
What we're going to do is to create a new page with a different set of Z, copy the equation into this page and forecast using the different set of Z. Note that if you had a lot of observations in your page, you could backup the existing Z, modify the values, forecast, and restore the Z without doing so in a different workfile (even better would be to use the model object to do this, but that requires a bit of tooling up on the concept of scenarios, which is probably overkill for your simple task).
You can do this interactively, but here is a command version of this process:
Code: Select all
' create a new page with enough obs to evaluate
pagecreate(page=def) efg u 1 500
' create a fake dependent and a smooth series for the z explanatory evaluation
series y = NA
series z = (@trend - 250)/100
' copy the existing equation into current page
copy abc\eq1 eq1
eq1.forecast probf
' plot the two series
group a z probf
freeze(probplot) a.xyline
' copy the graph back to original page and cleanup
copy probplot abc\probplot
pagedelete defNext, I copy the original equation from the first page to the new page, and use it to forecast (fit the probabilities). The remainder of the commands plot the series, copy the frozen graph back into the original page, and delete the new page.
Who is online
Users browsing this forum: No registered users and 1 guest
