我正在研究5种鸟类开始蜕皮的日子与这5种鸟类完成羽毛蜕皮所需的天数之间的相关性 .
我试图在下面的代码中模拟我的数据 . 对于5个物种中的每一个,我有10个人的开始日和10个人的持续时间 . 对于每个物种,我计算了平均开始日和平均持续时间,然后计算了这5个物种之间的相关性 .
我想做的是引导平均开始日期并引导每个物种的平均持续时间 . 我想重复这10,000次,并在每次重复后计算相关系数 . 然后,我想提取10,000相关系数的0.025,0.5和0.975分位数 .
我得到了模拟原始数据的能力,但是一旦我尝试引导,我的代码很快变得混乱 . 谁能帮我这个?
# speciesXX_start_day is the day of the year that 10 individuals of birds started moulting their feathers
# speciesXX_duration is the number of days that each individuals bird took to complete the moulting of its feathers
species1_start_day
species1_duration
species2_start_day
species2_duration
species3_start_day
species3_duration
species4_start_day
species4_duration
species5_start_day
species5_duration
start_dates
start_duration
library(plyr)
# mean start date for each of the 5 species
starts_mean
# mean duration for each of the 5 species
durations_mean
# correlation between start date and duration
cor(starts_mean, durations_mean)