optim() errors

Dr. Glasbrenner
Dr. Glasbrenner

Dear all,

If you’ve been working on question 5 on Assignment 4, you’ve probably encountered an error message when trying to run optim(). I looked into it and the error is happening because the dataset contains a row with NA entries, and optim() doesn’t like that. Before running optim(), if you pipe your dataset into remove_missing(na.rm = TRUE), for example:

fitting_datasets_fix <- fitting_datasets %>% remove_missing(na.rm = TRUE)

that will remove the offending rows. The dataset in fitting_datasets_fix should then work properly with optim().

Dr. Glasbrenner

local_offer assignment
local_offer errors