This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bootstrap On Correlation Coefficients In R

Bootstrapping on a correlation is useful because we know that the distribution of correlations is not normal since it's bounded between -1 and 1. In case of two data frames of equal size ( 100 X 10) in both how can this be done using R ?

First, I know we should find the correlation and get the pair-wise correlation across the two data frames.

How to Bootstrap the data by pulling out pairs with or without replacement. Then show the distribution of bootrapped values and the confidence interval as a histogram?

Maybe for such a sample data

      set.seed(1) 
      x <- matrix(rnorm(1000), nrow=100, ncol=10)
      y <- matrix(rnorm(1000), nrow=100, ncol=10).

I found a useful MATLAB code which I have added here Code in MATLABbootstrap correlation coeeficients. Is there something similar in R to obtain a similar plot ? I checked out the documentation in bootstrap package but was unable to understand.

r correlation

Just use random indices to select rows from your data, i.e. where df is your dataframe or matrix: samp <- df[sample(1:nrow(df), 100, replace=T),]. That will take a sample (with replacement) of 100 rows of your data.

closing because the question fails to produce relation to biology.

Please edit the original question, to improve it. Do not create a duplicate.

0 answers

No answers yet.

Log in to answer this question.