statsExpressions (version 0.3.1)

robcor_ci: Robust correlation coefficient and its confidence interval

Description

Custom function to get confidence intervals for percentage bend correlation coefficient.

Usage

robcor_ci(
  data,
  x,
  y,
  beta = 0.1,
  nboot = 100,
  conf.level = 0.95,
  conf.type = "norm",
  ...
)

Arguments

data

A dataframe (or a tibble) from which variables specified are to be taken. A matrix or tables will not be accepted.

x

A vector containing the explanatory variable.

y

The response - a vector of length the number of rows of x.

beta

bending constant (Default: 0.1). For more, see ?WRS2::pbcor.

nboot

Number of bootstrap samples for computing confidence interval for the effect size (Default: 100).

conf.level

Scalar between 0 and 1. If unspecified, the defaults return 95% lower and upper confidence intervals (0.95).

conf.type

A vector of character strings representing the type of intervals required. The value should be any subset of the values "norm", "basic", "perc", "bca". For more, see ?boot::boot.ci.

...

Currently ignored.

Value

A tibble with percentage bend correlation coefficient, along with its confidence intervals, and the number of bootstrap samples used to generate confidence intervals. Additionally, it also includes information about sample size, bending constant, no. of bootstrap samples, etc.

Examples

Run this code
# NOT RUN {
# for reproducibility
set.seed(123)
# }
# NOT RUN {
statsExpressions:::robcor_ci(
  data = mtcars,
  x = "hp",
  y = "mpg",
  beta = .01,
  nboot = 25,
  conf.level = .99,
  conf.type = c("basic")
)
# }

Run the code above in your browser using DataCamp Workspace