I am trying to run a regression on a bootstrapped sample in R.
The original sample looks like this dataframe (referred to as df) and has hundreds of entries. Y is the outcome variable, and treat is 0 or 1.
y treat
3 0
5 1
2 0
4 1
I have sampled with replacement to generate 900 observations from df$y.
set.seed(5)
b1 <- sample(df$y, 900, replace = TRUE, prob = NULL)
I have then run the following regression.
lm(b1 ~ treat, df)
When using the sample b1 as the outcome in the regression, does this automatically match up the correct value of b1 with the treat value from the original dataframe? If I want the outcome values in b1 to correspond to the correct treat value from the original dataframe, do I need to do something differently? How can I check that this is the regression I am trying to run?