Skip to contents

This function use bootstrapping to conduct hypothesis testing for the partial association coefficients. It directly applies onto the "PAsso" class of object generated by "PAsso".

Usage

test(object, bootstrap_rep = 300, H0 = 0, parallel = FALSE)

Arguments

object

An object of "PAsso" class, which is generated by "PAsso" function.

bootstrap_rep

The number of bootstrap replications. It may be slow.

H0

null hypothesis of partial correlation coefficient.

parallel

logical argument whether conduct parallel for bootstrapping partial association.

Examples

# Import ANES2016 data in "PAsso"
data(ANES2016)
# Parial association:
PAsso_2v <- PAsso(responses = c("PreVote.num", "PID"),
                adjustments = c("income.num", "age", "edu.year"),
                data = ANES2016)

summary(PAsso_2v, digits=4)
#> -------------------------------------------- 
#> The partial correlation coefficient matrix: 
#> 
#>              PreVote.num  PID   
#> PreVote.num  1.0000       0.4492
#> PID                       1.0000
#> -------------------------------------------- 
#> The marginal correlation coefficient matrix: 
#> 
#>              PreVote.num  PID   
#> PreVote.num  1.0000       0.7059
#> PID                       1.0000
#> 
#> --------------------------------------------
#> --------------------------------------------
#> 
#> The coefficients of fitted models are: 
#> 
#>             PreVote.num  PID       
#> income.num   0.0005       0.0009*  
#> Std. Error   0.0005       0.0004   
#> ---                                
#> age          0.0092***    0.0048***
#> Std. Error   0.0016       0.0013   
#> ---                                
#> edu.year    -0.0798***   -0.0459***
#> Std. Error   0.0117       0.0098   
#> ---                                
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

PAsso_2v_test <- test(object = PAsso_2v, bootstrap_rep=20, H0=0, parallel=FALSE)
#> The bootstrapping procedure may be slow when bootstrap_rep is large!
PAsso_2v_test
#> -------------------------------------------- 
#> The partial association analysis: 
#> 
#>              PreVote.num  PID   
#> PreVote.num  1.0000       0.4492
#> S.E.                      0.006 
#> Pr                        0.05* 
#> ---                             
#> PID                       1.0000
#> S.E.                            
#> Pr                              
#> ---                             
#> Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1