0

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 can I control for age and gender of the healthy resampling method ?

my data looks like this

Patient ID  Age Mean_RR SDNN    RMSSD   nn50    pnn50   SEX Year of birth.0.0   Date of all cause dementia report.0.0   Source of all cause dementia report.0.0 Date of alzheimer's disease report.0.0  Source of alzheimer's disease report.0.0    Date of vascular dementia report.0.0    Source of vascular dementia report.0.0
1.53E+09    56  1257    397.34  468 2   33.33   Female  1961    NA  NA  NA  NA  NA  NA
1.53E+09    56  1257    397.34  468 2   33.33   Female  1961    NA  NA  NA  NA  NA  NA

this is how I call the function

control_BPM <- abs(parametric_bootstrap_boot(control_BPM))
control_SDNN <- abs(parametric_bootstrap_boot(control_SDNN))
control_RMSSD <- abs(parametric_bootstrap_boot(control_RMSSD))
StupidWolf
  • 45,075
  • 17
  • 40
  • 72
EA90
  • 23
  • 5
  • If x is your dataset and it is data.table (you can convert a data frame to data.table) you can try to apply the function by gender and to specific age group like `DT[between(age, 30,50) , parametric_bootstrap_boot(x), gender]`. I have no idea how the data is, perhabs you should to put some sample data – K. Peltzer Nov 19 '20 at 10:32
  • you can apply your function to specific group. ceck some tutorials about like this https://www.datacamp.com/community/tutorials/bootstrap-r and it would be of your interest https://sejdemyr.github.io/r-tutorials/statistics/tutorial8.html (Propensity Score Matching) – K. Peltzer Nov 19 '20 at 10:43
  • Thanks a lot for the replay ,, these links really helpful. I have updated the post tho with sample data – EA90 Nov 19 '20 at 11:02
  • you are limited by the number of samples and if you control for all those samples above, I don't know what you can make of your bootstrap anymore. Ultimately, sample size is the limit, bootstrap doesn't help you. so whats the point of doing it? – StupidWolf Nov 20 '20 at 00:15

0 Answers0