EViews: How to estimate by OLS a more complex regression model? - eviews

For example I estimated by OLS the following model:
using an Eviews program file with code:
equation e1.ls log(cons) c log(sw) log(nsw) log(inc)
However, I have to now estimate this model:
But I am not sure how to go about writing the code. I tried typing:
equation e1.ls log(costs|kwh,pl,pk,pf) c log(kwh) log(pl) log(pk) log(pf) (log(kwh))^2
However, the first and last terms do not work and I'm not sure how to do it. I would appreciate any help, thank you!

EViews allows you to put the regression in equation form, as in
equation e1.ls log(costs)= c(1)*log(kwh)+ c(2)*log(pl)+ c(3)*log(pk) + c(4)*log(pf) + c(5)*(log(kwh))^2
but costs|kwh,pl,pk,pf doesn't mean anything in EViews.

Related

How to compute p-value when number of degrees of freedom and chi-square value are known?

I know how to do this in R: e.g. pchisq(18.98, df=2, lower.tail=FALSE)
However, I've no idea about how to write Stata code to solve this problem.
In case you're interested in more general post-estimation tests check out: help test.
Otherwise is seems like chi2(2,18.98) or chi2tail(2,18.98) are what you're after (depending on what lower.tail=FALSE means.
Note that in Stata you'll probably want to put this into a "local" in order to do other things with the output.
For example if you say the following to Stata:
local pchi2 = chi2(2,18.98)
display "chi2: `pchi2'"
Stata should reply:
chi2: .9999243958967154
See for more detail and links to the Stata manual section on statistical functions:
help chi2
help chi2tail

How can I test overdispersion in STATA when using xtpoisson and xtnbreg?

I have balanced panel data and my dependent variable is count one which distribution has lots of zero(0).
therefore I think it might be suitable for using negative binomial regression rather than poisson one. However, I cannot find how can I test whether xtnbreg or xtpoisson is suitable for my data.
If someone can help how can I test overdispersion to choose poisson model or nbmodel.
Thank you in advance!

Why ML.NET Matrix Factorization uses a regression evaluation?

The example of ML.NET for Matrix Factorization here has no evaluation method for testing the model. It's an one-class matrix factorization example, because its trainer option is set to options.LossFunction = MatrixFactorizationTrainer.LossFunctionType.SquareLossOneClass;
I searched further and found another matrix factorization example. Although it's not the one-class matrixfactorization but this time it has an evaluation. However the evaluation method is for a regression model. var metrics = mlcontext.Regression.Evaluate(prediction, labelColumnName: "Label", scoreColumnName: "Score");
Isn't matrix factorization a class of binary classification? Is it valid to use regression evaluation for the model? I actually put up this question a few times on the community chat for ML.NET but I've got no answers so far. Any comments or answers would be appreciated.
The problem that the second example is trying to solve is recommendation, if you look at line 55.
The metrics used for evaluation are the same as the regression metrics, that's why they are being used.
For more examples on Matrix Factorization you can look at the documentation:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.ml.trainers.matrixfactorizationtrainer?view=ml-dotnet-preview
https://github.com/dotnet/machinelearning/blob/master/docs/samples/Microsoft.ML.Samples/Dynamic/Trainers/Recommendation

Probability Models

What sort of tests are available in SAS that allow you to figure out what the probability of an event occurring is? And I do mean probability, not odds.
Specifically, I would like to know what is the probability a person might say yes vs. no to a particular type of surgery based on their age or insurance status?
I have tried logistic regression, but it appears to only return odds, and again, I am interested in a statistical test that returns probabilities, not odds.
You would think I could just google, "probability models (or tests) SAS" and get an answer, but strangely enough, I haven't - at least not one that is clear. So here I am.
Any help is appreciated. Thank you!
if you are getting odds from logistic regression. This is how the probability should be calculated.
Probability = odds/1+ odds

Using predict for ancillary parameters in maximum likelihood model in Stata

I wanted to know whether I can use the predict option for ancillary parameters (maximum likelihood ) program as follows (I estimated lnsigma and so sigma is the ancillary parameter in the model):
predict lnsigma, eq(lnsigma)
gen sigma=exp(lnsigma)
I also would like to know whether we can use above for heteroscedastic model.
Thank you in advance.
That sounds correct. I would be more explicit by typing predict lnsigma, xb eq(lnsigma). This way your code will not be broken when someone later on desides to write a prediction program for your estimation program and sets the default to something different than the linear prediction.
You can also do it in one line:
predictnl sigma = exp(xb(#2))
This assumes that lnsigma is the second equation in your model. If it is the third equation you replace xb(#2) with xb(#3). predictnl is also also an easy way of using the delta method to predict standard errors and confidence intervals for sigma.
I assume this is your own Stata program. If that is true, then you also have a third option: You can create your own prediction program, which Stata's predict command will recongnize. You can find some useful tricks on how to do that here: http://www.stata.com/help.cgi?_pred_se