0

I am working on a data set of employed and unemployed people. After estimation of parameters for (log)wages I am trying to predict values of (log)wages for unemployed people that would correspond with results that I have (in data set values for unemployed are N/A).

After using function predict I still get predictions only for employed people. Does anyone know how to get the full column of "predML"? Thank you in advance!!

ml_restricted <- selection(employed ~ schooling + age + agesq + married, logwage ~ schooling + age + agesq, data)
summary(ml_restricted)

# find predicted values

predML <- predict(ml_restricted)

data <- cbind(data, predML)

employed2 <- ifelse(data$employed == 1, "employed", "unemployed")

data <- cbind(data, employed2)
Pete
  • 3
  • 3
  • 2
    Can you make your post [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example)? Please provide your data using `dput(data)` and your code within the question itself instead of posting images. – jrcalabrese Jan 08 '23 at 22:31
  • Thank you for your comment. I provided a code but I am not sure if I am allowed to provide entire data online. If it is not possible to solve it without that I understand. Thank you once again! – Pete Jan 08 '23 at 23:31
  • 2
    where is the `selection()` function from? The general idea is that you can construct a **minimal** version of your task (e.g. with only a few rows and only one predictor variable?), which still illustrates the problem, so that it's easier to provide the data. Please read the link that @jrcalabrese provided ... – Ben Bolker Jan 09 '23 at 00:11
  • I guess from https://cran.r-project.org/web/packages/sampleSelection/sampleSelection.pdf ? – Ben Bolker Jan 09 '23 at 00:13
  • yes, it comes from sampleSelection package – Pete Jan 09 '23 at 00:15
  • Does `?predict.selection` help you .... ?? (I don't think I know enough about this fitting methodology to be of much use ...) – Ben Bolker Jan 09 '23 at 00:15
  • unfortunately I tried that, seems that in any case I am stuck with missing values. Tnx! – Pete Jan 09 '23 at 00:25

0 Answers0