invMillsRatio(sampleSelection)
invMillsRatio()所属R语言包:sampleSelection
Inverse Mill's Ratio of probit models
反穆勒的比例的概率模型
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Calculates the 'Inverse Mill's Ratios' of univariate and bivariate probit models.
计算的一元和二元probit模型的“逆米尔比率”。
用法----------Usage----------
invMillsRatio( x, all = FALSE )
参数----------Arguments----------
参数:x
probit model estimated by probit, glm or vglm.
概率模型估计probit,glm或vglm。
参数:all
a logical value indicating whether the inverse Mill's Ratios should be calculated for all observations.
一个逻辑值,该值指示是否应该计算的所有观测值的逆穆勒的比率。
Details
详细信息----------Details----------
The formula to calculate the inverse Mill's ratios for univariate probit models is taken from Greene (2003, p. 785), whereas the formulas for bivariate probit models are derived in Henning and Henningsen (2005).
从格林(2003年,第785页)的计算公式逆密尔的比例进行单因素的概率模型,,而二元probit模型的公式推导Henning和亨宁森(2005年)。
值----------Value----------
A data frame that contains the Inverse Mill's Ratios (IMR) and the delta values (see Greene, 2003, p. 784).
一个数据框包含逆米尔比率(IMR)和增量值(见格林,2003年,第784页)。
If a univariate probit estimation is provided, the variables IMR1 and IMR0 are the Inverse Mill's Ratios to correct for a sample selection bias of y = 1 and y = 0, respectively. Accordingly, 'delta1' and 'delta0' are the corresponding delta values.
如果一个单变量的概率估计,变量IMR1和IMR0是反穆勒的比率,分别为Y = 1,y = 0的一个样本选择偏差的纠正。因此,DELTA1和delta0是对应的δ值。
If a bivariate probit estimation is provided, the variables IMRa1, IMRa0, IMRb1, and IMRb0 are the Inverse Mills Ratios to correct for a sample selection bias of y = 1 and y = 0 in equations 'a' and 'b', respectively. Accordingly, 'deltaa1', 'deltaa0', 'deltab1' and 'deltab0' are the corresponding delta values.
如果一个二元概率估计,变量IMRa1,IMRa0,IMRb1,IMRb0是逆米尔斯比率为y = 1的一个样本选择偏差的纠正和y = 0a和b的,分别在方程式。因此,deltaa1,deltaa0,deltab1和deltab0是对应的δ值。
(作者)----------Author(s)----------
Arne Henningsen
参考文献----------References----------
Econometric Analysis, Fifth Edition, Prentice Hall.
Modeling Price Response of Farm Households in Imperfect Labor Markets in Poland: Incorporating Transaction Costs and Heterogeneity into a Farm Household Approach. Unpublished, University of Kiel, Germany.
实例----------Examples----------
## Wooldridge( 2003 ): example 17.5, page 590[#伍尔德里奇(2003年):例如17.5,页590]
data(Mroz87)
myProbit <- glm( lfp ~ nwifeinc + educ + exper + I( exper^2 ) + age +
kids5 + kids618, family = binomial( link = "probit" ), data=Mroz87 )
Mroz87$IMR <- invMillsRatio( myProbit )$IMR1
myHeckit <- lm( log( wage ) ~ educ + exper + I( exper^2 ) + IMR,
data = Mroz87[ Mroz87$lfp == 1, ] )
# using NO labor force participation as endogenous variable[NO作为内生变量的劳动力参与]
Mroz87$nolfp <- 1 - Mroz87$lfp
myProbit2 <- glm( nolfp ~ nwifeinc + educ + exper + I( exper^2 ) + age +
kids5 + kids618, family = binomial( link = "probit" ), data=Mroz87 )
all.equal( invMillsRatio( myProbit )$IMR1, invMillsRatio( myProbit2 )$IMR0 )
# should be true[应该是真实的]
# example for bivariate probit[例如二元概率]
## Not run: [#不运行:]
library( MASS )
library( VGAM, pos = 1e7, warn.conflicts = FALSE )
nObs <- 10000
# error terms (trivariate normal)[误差项(三元正常)]
sigma <- symMatrix( c( 2, 0.7, 1.2, 1, 0.5, 1 ) )
myData <- as.data.frame( mvrnorm( nObs, c( 0, 0, 0 ), sigma ) )
names( myData ) <- c( "e0", "e1", "e2" )
# exogenous variables (indepently normal)[外生变量(indepently正常)]
myData$x0 <- rnorm( nObs )
myData$x1 <- rnorm( nObs )
myData$x2 <- rnorm( nObs )
# endogenous variables[内生变量]
myData$y0 <- -1.5 + 0.8 * myData$x1 + myData$e0
myData$y1 <- ( 0.3 + 0.4 * myData$x1 + 0.3 * myData$x2 + myData$e1 ) > 0
myData$y2 <- ( -0.1 + 0.6 * myData$x1 + 0.7 * myData$x2 + myData$e2 ) > 0
# bivariate probit (using rhobit transformation)[二元概率(使用rhobit变换)]
bProbit <- vglm( cbind( y1, y2 ) ~ x1 + x2, family = binom2.rho,
data = myData )
summary( bProbit )
# bivariate probit (NOT using rhobit transformation)[双变量概率(不使用rhobit改造)]
bProbit2 <- vglm( cbind( y1, y2 ) ~ x1 + x2, family = binom2.rho(
lrho = "identity" ), data = myData )
summary( bProbit2 )
# inverse Mills Ratios[逆米尔斯比率]
imr <- invMillsRatio( bProbit )
imr2 <- invMillsRatio( bProbit2 )
all.equal( imr, imr2, tolerance = .Machine$double.eps ^ 0.25)
# tests[测试]
# E[ e0 | y1* > 0 & y2* > 0 ][E [E0 | Y1 *> 0&Y2 *> 0]]
mean( myData$e0[ myData$y1 & myData$y2 ] )
mean( sigma[1,2] * imr$IMR11a + sigma[1,3] * imr$IMR11b, na.rm = TRUE )
# E[ e0 | y1* > 0 & y2* <= 0 ][E [E0 | Y1 *> 0&Y2 <= 0]]
mean( myData$e0[ myData$y1 & !myData$y2 ] )
mean( sigma[1,2] * imr$IMR10a + sigma[1,3] * imr$IMR10b, na.rm = TRUE )
# E[ e0 | y1* <= 0 & y2* > 0 ][E [E0 | Y1 <= 0&Y2 *> 0]]
mean( myData$e0[ !myData$y1 & myData$y2 ] )
mean( sigma[1,2] * imr$IMR01a + sigma[1,3] * imr$IMR01b, na.rm = TRUE )
# E[ e0 | y1* <= 0 & y2* <= 0 ][E [E0 | Y1 <= 0&Y2 <= 0]]
mean( myData$e0[ !myData$y1 & !myData$y2 ] )
mean( sigma[1,2] * imr$IMR00a + sigma[1,3] * imr$IMR00b, na.rm = TRUE )
# E[ e0 | y1* > 0 ][E [E0 | Y1 *> 0]]
mean( myData$e0[ myData$y1 ] )
mean( sigma[1,2] * imr$IMR1X, na.rm = TRUE )
# E[ e0 | y1* <= 0 ][E [E0 | Y1 <= 0]]
mean( myData$e0[ !myData$y1 ] )
mean( sigma[1,2] * imr$IMR0X, na.rm = TRUE )
# E[ e0 | y2* > 0 ][E [E0 | Y2> 0]]
mean( myData$e0[ myData$y2 ] )
mean( sigma[1,3] * imr$IMRX1, na.rm = TRUE )
# E[ e0 | y2* <= 0 ][E [E0 | Y2 * <= 0]]
mean( myData$e0[ !myData$y2 ] )
mean( sigma[1,3] * imr$IMRX0, na.rm = TRUE )
# estimation for y1* > 0 and y2* > 0[估计Y1 *> 0和y2 *> 0]
selection <- myData$y1 & myData$y2
# OLS estimation[OLS估计]
ols11 <- lm( y0 ~ x1, data = myData, subset = selection )
summary( ols11 )
# heckman type estimation[赫克曼型估计]
heckit11 <- lm( y0 ~ x1 + IMR11a + IMR11b, data = cbind( myData, imr ),
subset = selection )
summary( heckit11 )
# estimation for y1* > 0 and y2* <= 0[估计Y1 *> 0和y2 * <= 0]
selection <- myData$y1 & !myData$y2
# OLS estimation[OLS估计]
ols10 <- lm( y0 ~ x1, data = myData, subset = selection )
summary( ols10 )
# heckman type estimation[赫克曼型估计]
heckit10 <- lm( y0 ~ x1 + IMR10a + IMR10b, data = cbind( myData, imr ),
subset = selection )
summary( heckit10 )
# estimation for y1* <= 0 and y2* > 0[估计Y1 * <= 0和y2 *> 0]
selection <- !myData$y1 & myData$y2
# OLS estimation[OLS估计]
ols01 <- lm( y0 ~ x1, data = myData, subset = selection )
summary( ols01 )
# heckman type estimation[赫克曼型估计]
heckit01 <- lm( y0 ~ x1 + IMR01a + IMR01b, data = cbind( myData, imr ),
subset = selection )
summary( heckit01 )
# estimation for y1* <= 0 and y2* <= 0[估计Y1 * <= 0和y2 * <= 0]
selection <- !myData$y1 & !myData$y2
# OLS estimation[OLS估计]
ols00 <- lm( y0 ~ x1, data = myData, subset = selection )
summary( ols00 )
# heckman type estimation[赫克曼型估计]
heckit00 <- lm( y0 ~ x1 + IMR00a + IMR00b, data = cbind( myData, imr ),
subset = selection )
summary( heckit00 )
# estimation for y1* > 0[估计Y1 *> 0]
selection <- myData$y1
# OLS estimation[OLS估计]
ols1X <- lm( y0 ~ x1, data = myData, subset = selection )
summary( ols1X )
# heckman type estimation[赫克曼型估计]
heckit1X <- lm( y0 ~ x1 + IMR1X, data = cbind( myData, imr ),
subset = selection )
summary( heckit1X )
# estimation for y1* <= 0[估计Y1 <= 0]
selection <- !myData$y1
# OLS estimation[OLS估计]
ols0X <- lm( y0 ~ x1, data = myData, subset = selection )
summary( ols0X )
# heckman type estimation[赫克曼型估计]
heckit0X <- lm( y0 ~ x1 + IMR0X, data = cbind( myData, imr ),
subset = selection )
summary( heckit0X )
# estimation for y2* > 0[估计Y2> 0]
selection <- myData$y2
# OLS estimation[OLS估计]
olsX1 <- lm( y0 ~ x1, data = myData, subset = selection )
summary( olsX1 )
# heckman type estimation[赫克曼型估计]
heckitX1 <- lm( y0 ~ x1 + IMRX1, data = cbind( myData, imr ),
subset = selection )
summary( heckitX1 )
# estimation for y2* <= 0[估计Y2 <= 0]
selection <- !myData$y2
# OLS estimation[OLS估计]
olsX0 <- lm( y0 ~ x1, data = myData, subset = selection )
summary( olsX0 )
# heckman type estimation[赫克曼型估计]
heckitX0 <- lm( y0 ~ x1 + IMRX0, data = cbind( myData, imr ),
subset = selection )
summary( heckitX0 )
## End(Not run)[#(不执行)]
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|