Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

A First Course in Differential Equations with Modeling Applications

Authors: Dennis G. Zill

11th edition

1305965728, 978-1305965720

More Books

Students also viewed these Mathematics questions