SCM

Forum: open-discussion

Monitor Forum | Start New Thread Start New Thread
RE: Marginal effects in mvProbit [ Reply ]
By: Arne Henningsen on 2015-01-31 22:29
[forum:41859]
Dear Sabri

I cannot run the code, because I get an error message:

R> read.dta("model3.dta")
Error in read.dta("model3.dta") : not a Stata version 5-12 .dta file

Best regards,
Arne

RE: Marginal effects in mvProbit [ Reply ]
By: Sabri Ciftci on 2014-06-02 03:42
[forum:41852]

model3.dta (13) downloads
OK, I understand now. Although, I do not need the marginals calculated at means for my paper, I would like to learn my mistake.

I am attaching the code and the data. As I mentioned before, I am new to R. Could not figure out how to send this as a single R file.

thank you for being so patient with me

###Data and code for Arne regarding mvprobit
##install packages and import data
library(foreign)
library("mvProbit")
install.packages<-("mvtnorm")
install.packages<-("maxLik")
install.packages<-("miscTools")
install.packages<-("abind")

mydata <- read.dta("c://data//model1.dta")
estResult <- mvProbit(cbind(SArabia, Turkey, Iran) ~secular + age,
data=mydata, method="BHHH", algorithm= "GHK", nGHK=500)
margEffUncMean <- margEff( estResult, atMean = TRUE, calcVCov = TRUE )

Sabri

RE: Marginal effects in mvProbit [ Reply ]
By: Arne Henningsen on 2014-06-01 22:04
[forum:41081]
Dear Sabri

As "AtMean" is not equal to the name of an argument of margEff.mvProbit(), mvProbitMargEff(), mvProbitExp(), or pmvnorm(), argument "AtMean=TRUE" is simply ignored. Hence, your command does not return the marginal effects at mean values.

Best regards,
Arne

RE: Marginal effects in mvProbit [ Reply ]
By: Sabri Ciftci on 2014-06-01 12:53
[forum:41080]
Dear Arne,
The code works now with a minor modification.
when I type:
"atMean=TRUE" I get an error. However:
"AtMean=TRUE" works perfectly. Note the uppercase letter

It may be something in my computer that R does not like. But I got all the results now, and cited mvProbit in my paper.

Many thanks
sabri

RE: Marginal effects in mvProbit [ Reply ]
By: Arne Henningsen on 2014-06-01 08:24
[forum:41079]
Dear Sabri

Thank you for your message. You might have discovered a bug in mvProbit. Can you please post a small self-contained reproducible example?

Best regards,
Arne

RE: Marginal effects in mvProbit [ Reply ]
By: Sabri Ciftci on 2014-05-30 04:56
[forum:41078]
Dear Arne
Thank you for your help about running mvProbit..

Now, I obtained the estimation results for all models. I also obtained various marginal effects calculated for all observations. However, the only marginal effects I am unable to get are the ones calculated at means.

After I run mvProbit, and obtain unconditional marginal effects for all observations, I try to calculate the marginal effects at their mean value and I get the following:

> margEffUncMean <- margEff( estResult, atMean = TRUE, calcVCov = TRUE )
Error in colMeans(data) : 'x' must be numeric

I am sure, I am probably missing something simple here. Trying to figure out what could be causing this problem? Any suggestions...
thanks

Sabri

Again, many thanks for the help and for this great package. The package is very intuitive and it helps with my research a lot.

Sabri

RE: Marginal effects in mvProbit [ Reply ]
By: Kelvin Mashisia on 2013-01-14 10:13
[forum:38703]
Dear Arne,

I will definitely cite mvProbit in my publications. Thanks again.

Kelvin

RE: Marginal effects in mvProbit [ Reply ]
By: Arne Henningsen on 2013-01-14 10:11
[forum:38702]
Dear Kelvin

I am happy to hear that you succeeded with your analysis. Please do not forget to cite mvProbit in your publications. Thanks :-)

Best regards,
Arne

RE: Marginal effects in mvProbit [ Reply ]
By: Kelvin Mashisia on 2013-01-14 09:58
[forum:38701]
Dear Arne and Ott,

Many thanks for your help. I have successfully calculated the marginal effects by setting the argument "atMean" of the margEff() method to "TRUE".

Best regards,
Kelvin

RE: Marginal effects in mvProbit [ Reply ]
By: Arne Henningsen on 2013-01-11 07:22
[forum:38686]
Dear Kelvin and Ott

@Ott: the "mvProbit" package is part of the "sampleSelection" *project* on R-Forge. Hence, this forum is not only for questions regarding the "sampleSelection" *package* but also for questions regarding the other packages in the "sampleSelection" *project* (i.e. "censReg", "intReg", and "mvProbit").

@Kelvin: You can set argument "atMean" of the margEff() method to "TRUE" in order to calculate the marginal effects at mean values. Alternatively, you can set the data manually (e.g. to the mean values) with argument "data" of the margEff() method or mvProbitMargEff().

Best,
Arne

RE: Marginal effects in mvProbit [ Reply ]
By: Ott Toomet on 2013-01-11 07:07
[forum:38685]
Dear Kelvin,
mvProbit belongs to mvProbit package, AFAIK, so it does not have direct connection to sampleSelection. You may want to ask the maintainers of that package, or, as it seems to be a sort of statistical question, the general R help.

That said, mvProbit marginal effects should be pretty strightforward to do. They (approximately) answer the question: what happens to your outcome variable (probability), if a given explanatory variable changes by one unit, given all the other explanatory variables are kept at their average values. You can approach this question either by taking a differential (the standard way), or by finite difference methods (may be more appropriate for e.g. gender). I haven't used mvProbit and don't want to do the math myself, but it is a strightforward calculus.

Best,
Ott

Marginal effects in mvProbit [ Reply ]
By: Kelvin Mashisia on 2013-01-11 05:31
[forum:38684]
Hi,

I have successfully estimated a multivariate probit model in R and I have coefficients, standard errors, z-scores as well as the p-values. I'm however, stuck on computing the marginal effects, not on all observations but the sample means. The marginal effects that I'm getting are for the n observations that I have. My dependent variables are crpnwvr, crpshcy, crpdrtl, crpexar, crpstir, and crpelpt while explanatory variables are sex, hhsize, owndland1, grp access_info, and access_water. The data file is nyandodata2.csv. Please help. Thank you.

Kelvin

Thanks to:
Vienna University of Economics and Business Powered By FusionForge