Tutor profile: Tomas C.
Subject: R Programming
What is the difference between `&` and `&&` in R?
The functional `&` is a vectorized operation, meaning it can return a vector. For example: x <- 1:10 x %% 2 == 0 & x > 5 will return a vector  FALSE FALSE FALSE FALSE FALSE TRUE FALSE TRUE FALSE TRUE On the other hand, `&&` only evaluates the first element of each vector x <- 1:10 x %% 2 == 0 && x > 5  FALSE
What is a general method to estimate the variance of an estimator when it is not possible to derive its formula?
Bootstrap is an excellent option. It takes samples with replacement from the sample obtained, calculates the estimate with each subsample as the original sample, and estimates the variability through the variability in the estimates of the subsamples. This method also allows to obtain the whole sampling distribution of an estimator, meaning we could estimate much more interesting things than just the variance.
Subject: Data Science
Can you include explanatory variables in a linear model when it is not related linearly with the response variable?
Yes. The term linear model does not mean that each explanatory variable is linearly related to the outcome. It just means that each of the terms of the model is related to the outcome linearly. Then, the model $$y = \beta_0 + \beta_1x + \beta_2x^2 $$ is linear because each predictor, $$x$$ and $$x^2$$ is linearly related to $$y$$ through each $$\beta$$ coefficient. However, it does not mean that $$y$$ and $$x$$ are linearly related. The relationship shown there is quadratic, indeed.
needs and Tomas will reply soon.