How to use the argument stype in boot-package in R? The stype argument in boot of R can take 3 values: "i" which is the default, "w" or "f".
What is the concept of "w" and "f"? I really tried to find articles about this stuff, but they are scarce. Can anybody explain them to me and show examples of codes on how to use them for linear regression models (implementing bootstrapping)?


What is the concept of "w" and "f"?

A simple call to boot::boot is
boot(data, statistic, R, stype)

[Note: I'm assuming that sim = "ordinary", the default.]
This will take a data set (data), generate the desired number of bootstrap replicates (R), and compute some sample statistic (statistic) for each one.
The function statistic requires two arguments; the first is the original data (data), whereas the second argument tells it which rows/elements of the original data appear in a particular bootstrap sample. You can do this in three different ways, which correspond to the three possible arguments for stype.
Suppose that you just want to compute the sample mean of each bootstrap replicate. You can specify this in three different ways:
Indices (stype = "i") are the indices of the elements that appear in this sample, so your statistic would be
mean_i <- function(data, indices) mean(data[indices])
Frequencies (stype = "f"): are the raw frequencies of each element in this sample, so your statistic would be
mean_f <- function(data, frequencies) sum(data * frequencies) / sum(frequencies)
Weights (stype = "w"): are the relative frequencies (weights) of each element in this sample, so your statistic would be
mean_weights <- function(data, weights) sum(data * weights)
