SCM

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: sampleSelection [ Reply ]
By: Arne Henningsen on 2014-11-22 21:43
[forum:41671]
Thanks again, Ayuba, for reporting this bug and for providing a reproducible example. The example was very helpful in fixing the bug. The source code of the sampleSelection package in the SVN repository at R-Forge [1] already includes the bug fix. The sampleSelection package available at R-Forge [2] will soon include the bug fix (as soon as "Rev." >= 1597), and the sampleSelection package at CRAN [3] will include the bug fix at some later time.

[1] https://r-forge.r-project.org/scm/?group_id=256

[2] https://r-forge.r-project.org/R/?group_id=256

[3] http://cran.at.r-project.org/package=sampleSelection

RE: sampleSelection [ Reply ]
By: Arne Henningsen on 2014-11-21 08:00
[forum:41666]
Thank you, Ayuba, for posting a reproducible example. I can confirm the bug in 'model.matrix(out)' and will fix it asap. Arne

RE: sampleSelection [ Reply ]
By: Ayuba Seidu on 2014-11-21 03:21
[forum:41665]
Using your own example
set.seed(0)
library("sampleSelection")
library("mvtnorm")
vc <- diag(3)
vc[lower.tri(vc)] <- c(0.9, 0.5, 0.1)
vc[upper.tri(vc)] <- vc[lower.tri(vc)]
eps <- rmvnorm(500, c(0, 0, 0), vc)
xs <- runif(500)
ys <- xs + eps[, 1] > 0
xo1 <- runif(500)
yo1 <- xo1 + eps[, 2]
xo2 <- runif(500)
yo2 <- xo2 + eps[, 3]
out=selection(ys ~ xs, list(yo1 ~ xo1, yo2 ~ xo1))

The outcome equations, in my case, have the same explanatory variables.

RE: sampleSelection [ Reply ]
By: Arne Henningsen on 2014-11-16 06:57
[forum:41644]
Dear Ayuba

Please provide a minimal self-contained reproducible example.

Best regards,
Arne

sampleSelection [ Reply ]
By: Ayuba Seidu on 2014-11-13 02:55
[forum:41637]
I am trying to get fitted values using Tobit-5 estimation for my outcome equations, however I get Error in model.matrix.default(object$termsO1, mf) :model frame and formula mismatch in model.matrix()
Below is part of my code

#setting up outcome real earnings variables
data$setRW=ifelse(data$mig==0,data$wage,NA)
data$migRW=ifelse(data$mig==1,data$wage,NA)

ys=mig~age+age2+women+mar+educ+accomp+nhh+
forb+fpov+hlt6+h0613+h1417+finc+exp+exp2+
nfexp+nfexp2+ill+mex+bl+wh+fwks+wh+nhh+
skill+unskNill+ctor+px+hr+spec+east+seast+mwest+
nwest+swest+dum01+veg+hort+fruit

yo1=setRW~age+age2+women+educ+forb+accomp+hlt6+hlt6+h0613+h1417+
exp+exp2+chrs+ill+skill+bl+wh+mex+unskNill+
ctor+px+hr+east+seast+mwest+nwest+swest+dum01+
veg+hort+fruit

yo2=migRW~age+age2+women+educ+forb+accomp+hlt6+h0613+h1417+
exp+exp2+chrs+ill+skill+bl+wh+mex+unskNill+
ctor+px+hr+east+seast+mwest+nwest+swest+dum01+
veg+hort+fruit

library("sampleSelection")
out=selection(ys,list(yo1,yo2),data=data)
summary(out)
f=data.frame(fitted(out,part="outcome"))

I hope this helps. Thanks in advance

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