Page 1 of 1

Import and plotting

Posted: Tue Jul 08, 2014 11:12 pm
by GWilson
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!

Re: Import and plotting

Posted: Wed Jul 09, 2014 7:33 am
by EViews Glenn
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.

Re: Import and plotting

Posted: Wed Jul 09, 2014 8:51 am
by EViews Gareth
With regards to getting the .xlsx file in - how did you try to do it?

Re: Import and plotting

Posted: Wed Jul 09, 2014 9:04 am
by GWilson
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.

Re: Import and plotting

Posted: Wed Jul 09, 2014 9:18 am
by EViews Gareth
Could you provide the .xlsx file? It should have worked.

Re: Import and plotting

Posted: Wed Jul 09, 2014 9:41 am
by GWilson
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?

Re: Import and plotting

Posted: Wed Jul 09, 2014 9:47 am
by EViews Gareth
Sure.

Re: Import and plotting

Posted: Wed Jul 09, 2014 8:46 pm
by EViews Gareth
File received, and was able to open without any problems. Are you certain you tried Open->Foreign Data As Workfile?

Re: Import and plotting

Posted: Wed Jul 09, 2014 8:58 pm
by GWilson
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.

Re: Import and plotting

Posted: Thu Jul 10, 2014 2:49 pm
by EViews Glenn
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.

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
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:

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 def
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.