library(car); library(lmtest) #para desvios-padrao robustos #estimar MPL linprob <- lm(inlf~ nwifeinc+educ+exper+I(exper^2)+age+kidslt6+kidsge6,data=MROZ) #estimar modelo logit logitres<-glm(inlf~ nwifeinc+educ+exper+I(exper^2)+age+kidslt6+kidsge6,family=binomial(link=logit),data=MROZ) summary(logitres) #estimar modelo probit probitres<-glm(inlf~ nwifeinc+educ+exper+I(exper^2)+age+kidslt6+kidsge6,family=binomial(link=probit),data=MROZ) summary(probitres) #calcular indices lineares nos valores individuais xb.log<-predict(logitres) xb.prob<-predict(probitres) #fatores APE=media(g(xb)) factor.log<-mean(dlogis(xb.log)) factor.prob<-mean(dnorm(xb.prob)) cbind(factor.log, factor.prob) #efeitos parciais médios=beta*factor APE.lin<-coef(linprob)*1 APE.log<-coef(logitres)*factor.log APE.prob<-coef(probitres)*factor.prob #tabela APEs cbind(APE.lin, APE.log,APE.prob)