Question
First, import the boot package and use boot() to find the R bootstrap of the statistic. To do this, complete the script below. Run R
First, import the boot package and use boot() to find the R bootstrap of the statistic. To do this, complete the script below. Run R = 1000 replicas. The inputs for your boot function will be for iris and corr.fun. Once coded, display the results of the boot function and enter the full observed value of the statistic applied to the data. This value will be labeled as "original" in the returned object. Your value should be less than 1 and contain 7 decimal places (i.e. 0.#######)
The statistic you will be using, corr.fun, has been defined for you. Note that Spearman's correlation in statistics is a nonparametric alternative to Pearson's correlation. Use Spearman's correlation for data that follow curvilinear, monotonic relationships and for ordinal data. Statisticians also refer to Spearman's rank order correlation coefficient as Spearman's (rho)
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)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started