Question: library(boot) #Customfunctiontofindcorrelation #betweenthePetalLengthandWidth corr.fun

library(boot)

#Customfunctiontofindcorrelation

#betweenthePetalLengthandWidth

corr.fun<-function(data,idx){

df<-data[idx,]

#Findthespearmancorrelationbetween

#the3rdand4thcolumnsofdataset

c(cor(df[,3],df[,4],method='spearman'))

}

#donotchangetheseed;usedforreproducability

set.seed(42)

#Performthebootstrapwith1000replicas

#results<-boot(data=iris,statistic=corr.fun,R=1000)

bootstrap<-boot(data=iris,statistic=corr.fun,R=1000)

#Displaytheresultsofthebootfunction

print(bootstrap)

#Displaythefullobservedvalueofthestatisticappliedtothedata

#original_value<-corr.fun(iris,1:nrow(iris))

#print(paste("Originalvalue:",original_value))

original_value<-bootstrap$t0

print(paste("Originalvalueofthestatistic:",original_value))

Using boot.ci, calculate the confidence interval using percentile bootstrap (type = "perc"). The variable bootstrap has been calculated for you but the calculation is hidden

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!