Place results of predict() in a for loop inside a list
问题 Let us say I want to run the linear regression model on the mtcars dataset several times on different samples. The idea is, for each iteration in a for loop, to store the results of the predict() method every time the linear regression is run for a different sample. The small example follows for one run: ## Perform model once on a Sample and use model on full dataset: Sample_Size <- 10 Sample <- mtcars[sample(nrow(mtcars), Sample_Size), ] Model <- lm(formula = mpg ~ wt, data = Sample)