R - bootstrapping with control for age and gender
问题 I have a very unbalanced dataset ,, thousands of healthy participants and 21 patients (16 male and 5 female) ,, I want to use bootstrapping to define a new sampler but with control of age and gender. this is the method i'm using parametric_bootstrap_boot <- function(x) { # Perform bootstrap using boot package # Estimate mean mu <- boot(x, samplemean, R=1000)$t0 #Estimate sd sd <- boot(x, samplesd, R=1000)$t0 # Sample 21 observations set.seed(1) samples <- rnorm(21,mu,sd) return(samples) } how