[R] Using mfx to create marginal effects

T.Riedle tr206 at kent.ac.uk
Sat Jun 17 12:26:14 CEST 2017

Dear all,

I am trying to estimate the marginal effects of a logit regression using the mfx package. It is crucial that the standard errors are clustered at the year level. Hence, the code looks as follows:

marginal.t24.2<-logitmfx(stock.market.crash~crash.t24+bubble.t24+RV.t24,data=Data_logitregression_lags, clustervar1 = "year")

marginal.t24.4<-logitmfx(stock.market.crash~crash.t24+bubble.t24+MP.t24+UTS.t24+UPR.t24+PPI.t24+RV.t24,data=Data_logitregression_lags, clustervar1 = "year")

Is it correct to use clustervar1 = "year" to have year clustered standard errors?

In addition I would like to create a table. I thought that stargazer would be appropriate but the following code is not working:

stargazer(marginal.t24.2, marginal.t24.4, title="Marginal effects result",type="text",out="Marginalt24logit-exportJun2017.txt")

R returns following error:

% Error: Unrecognized object type.

How can I create a table with marginal effects and the corresponding standard errors? Is there an alternative to stargazer?

Thanks for your support in advance.

Kind regards.

	[[alternative HTML version deleted]]

More information about the R-help mailing list