I am trying to take bootstrap samples and conduct stepwise regression in R. I am trying to look at the distribution of the regression coefficients, but the "bhat" matrix I am working on is mostly printing out NAs with the exception of the first row (which is the same number across all columns). How can I fix this?
B <- 100 #number of bootstrap samples
n <- nrow(dat)
d <- ncol(dat) - 1
bhat <- matrix(NA, nrow = B, ncol = ncol(dat) - 1)
for(b in 1:B) {
  s <- sample(1:n, n, replace=TRUE)
  samp <- as.matrix(dat[s, c(1:15)])
  samp <- as.data.frame(samp)
  #stepwise regression
  null <- lm(dat$Y ~ 1, data=samp)
  full <- lm(dat$Y ~ ., data=samp)
  fit <- step(null, scope=formula(full), direction="forward", k=log(n), trace=0)
  bhat[b,] <- coef(fit)
}
