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)

Using the plot() function, plot bootstrap and select the histogram that best matches your plot. The variable bootstrap is the result from the boot function above. Make sure to define it here before running the plot.

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!