bootstrap_r_squared_change: Bootstrap estimate of popualtion r-squared change

Description Usage Arguments Details Value See Also Examples

View source: R/bootstrap_r_squared_change.R

Description

The function provides a bootstrapped estimate with confidence intervals of population r-squared change.

Usage

1
2
bootstrap_r_squared_change(data, dv, ivs1, ivs2, iterations = 1000,
  ci = 0.95, method = "olkinpratt")

Arguments

data

data.frame

dv

character scalar with name of dependent variable

ivs1

character vector of variable names in data typically corresponding to personality factors

ivs2

character vector of variable names in data typically corresponding to personality facets

iterations

positive number indicating number of bootstrap iterations to run

ci

number between 0 and 1 indicating size of bootstrap confidence interval. Default value is .95 representing a 95% confidence interval.

method

See method argument for adjusted_r_squared function. Default value is olkinpratt which is designed where inference is desired to the situation where the predictor variables are assumed to be random.

Details

Population r-squared change is defined as

Δρ^2 = ρ^2_{ivs2} - ρ^2_{ivs1}

The Bootstrapping procedure applies the formula for adjusted r-squared twice, once to remove the bootstrap bias, and a second time to remove the bias inherent to the r-squared formula. There are several methods available (See the method argument for the adjusted_r_squared function). However, in general if you assume that the predictors are random then "olkinpratt" is a good option. If you assume that the predictors are fixed, then "ezekiel" is a good option. However, generally the results are fairly similar for the two methods We provide the following rough guide for choosing the number of iterations: 100 for basic error checking; 1,000 for exploratory analyses; 10,000 or more is recommended for publication.

Confidence intervals are based on sample quantiles. For example, .95 ci corresponds to .025 and .975 quantiles of the bootstrap sample estimates.

For simplicity and consistency this function does not currently permit missing data. A simple option to exclude missing data is to apply na.omit on the data frame. Alternatively, various data imputation approaches could be adopted.

Value

an object of class bootstrap_r_squared_change.

variables, data, iterations, ci, method

copy of corresponding arguments

See Also

print.bootstrap_r_squared_change

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
## Load data and meta data:
data(facets_data); data(facets_meta)

## Using 50 iterations is too few, but is used here to
##     make example run quickly.

## This version explicitly states the variables:
bootstrap_r_squared_change(facets_data, "swl",
    c("ipip_neuroticism", "ipip_extraversion",
      "ipip_openness", "ipip_agreeableness", "ipip_conscientiousness"),
    c("ipip_n_anxiety", "ipip_n_anger",
       "ipip_n_depression", "ipip_n_self_consciousness",
      "ipip_n_immoderation", "ipip_n_vulnerability",
      "ipip_e_friendliness", "ipip_e_gregariousness",
      "ipip_e_assertiveness", "ipip_e_activity_level",
      "ipip_e_excitement_seeking", "ipip_e_cheerfulness",
      "ipip_o_imagination", "ipip_o_artistic_interests",
      "ipip_o_emotionality", "ipip_o_adventurousness",
      "ipip_o_intellect", "ipip_o_liberalism",
      "ipip_a_trust", "ipip_a_morality",
      "ipip_a_altruism", "ipip_a_cooperation",
      "ipip_a_modesty", "ipip_a_sympathy",
      "ipip_c_self_efficacy", "ipip_c_orderliness",
      "ipip_c_dutifulness", "ipip_c_achievement_striving",
      "ipip_c_self_discipline", "ipip_c_cautiousness"),
     iterations=50)

## Alternatively, it is often clearer to store the variables
##      in character vectors.
## For example:
facets_meta

## These can be applied as follows:
bootstrap_r_squared_change(facets_data, facets_meta$swb[1],
                           facets_meta$ipip_factors,
                           facets_meta$ipip_facets,
                           iterations=50)

jeromyanglim/personalityfacets documentation built on Dec. 23, 2019, 7:31 p.m.