Skip to content
Prev 386762 / 398502 Next

Error Running Bootstrap Function within Wrapper Function

Hi Stephen,

Thanks for the advice, from my understanding, the function foo1 should
provide a vector of coefficients which are the same length as the columns
in the data frame provided. This is based on the results from glmnet. With
foo2, this should be the same case, I've provided an if statement that
performs OLS if the sum of coef_nonzero is greater than 0. Meaning there
should be at least one independent variable from the original data set to
perform OLS since it's coefficient from glmnet was nonzero.

I previously have not had any issues with this method for other tests I
have run, it seems to only occur as this data increases in observations.
Would it be possible for you to look at the attached file? I provide a new
foo1 function that generates the data I am using, the same 3 functions I
sent previously, and the function I am using for glmnet. I'm still not sure
why, but as the number of bootstrap samples increases, I get an error with
my methods, particularly with foo3.

At this point, I think the problem could be with the wrapper function or
with the data itself.

I appreciate any help I can get at this point. I've been trying to debug
this function for almost a month.

Thanks,

Kevin


https://www.dropbox.com/s/1sdidrnmzrqmukt/r-help%20example.R?dl=0

On Wed, Jan 6, 2021 at 12:48 PM Stephen Ellison <S.Ellison at lgcgroup.com>
wrote: