Skip to contents

Cluster-robust (by person) standard errors with a \(t(G - 1)\) reference distribution, \(G\) being the number of persons, as in silence_test. With few persons (single-case or small samples) the cluster-robust intervals are unreliable; a bootstrap over days of the estimates (refitting fit_pairs on resampled day blocks) is the alternative, and silence_test implements it for the test.

Usage

# S3 method for pairs_fit
summary(object, level = 0.95, ...)

# S3 method for pairs_fit
coef(object, ...)

# S3 method for pairs_fit
vcov(object, ...)

# S3 method for pairs_fit
confint(object, parm, level = 0.95, ...)

# S3 method for pairs_fit
nobs(object, ...)

Arguments

object

A pairs_fit.

level

Confidence level.

...

Ignored.

parm

Coefficient names or indices (default: all).

Value

summary returns a data frame with one row per lagged coefficient ("Y<-X" names the effect of X at \(t-1\) on

Y at \(t\)) and the columns coef, estimate,

se, lower, upper, z (the ratio of the estimate to its standard error, referred to \(t(G - 1)\)) and p.

coef returns the stacked rows of \(\Phi\) as a named vector, vcov their cluster-robust covariance matrix,

confint a two-column matrix of limits and nobs the number of complete pairs.

References

Cameron, A. C., & Miller, D. L. (2015). A practitioner's guide to cluster-robust inference. Journal of Human Resources, 50, 317-372. doi:10.3368/jhr.50.2.317

Examples

sim <- simulate_ema(N = 30, n_prompts = 20, seed = 2)
f <- fit_pairs(sim$data, sim$vars)
summary(f)
#>                coef    estimate         se       lower         upper          z
#> 1        NegA<-NegA  0.31864968 0.05385429  0.20850529  0.4287940692  5.9168857
#> 2        NegA<-PosA  0.01308081 0.05022154 -0.08963378  0.1157954021  0.2604621
#> 3      NegA<-Stress  0.07893991 0.04595174 -0.01504195  0.1729217769  1.7178872
#> 4     NegA<-Fatigue  0.05277375 0.06486947 -0.07989921  0.1854467128  0.8135376
#> 5        PosA<-NegA -0.00649879 0.05386124 -0.11665739  0.1036598062 -0.1206580
#> 6        PosA<-PosA  0.34486455 0.07411051  0.19329153  0.4964375636  4.6533824
#> 7      PosA<-Stress  0.04767025 0.07049030 -0.09649859  0.1918390941  0.6762669
#> 8     PosA<-Fatigue  0.02694751 0.06603028 -0.10809958  0.1619945961  0.4081084
#> 9      Stress<-NegA  0.01450827 0.07181193 -0.13236362  0.1613801602  0.2020314
#> 10     Stress<-PosA  0.01130966 0.05823713 -0.10779865  0.1304179707  0.1942002
#> 11   Stress<-Stress  0.57183741 0.07396195  0.42056823  0.7231065816  7.7315079
#> 12  Stress<-Fatigue  0.03286818 0.06432083 -0.09868270  0.1644190507  0.5110036
#> 13    Fatigue<-NegA -0.08350106 0.10383257 -0.29586251  0.1288603876 -0.8041895
#> 14    Fatigue<-PosA -0.13066866 0.06345996 -0.26045884 -0.0008784768 -2.0590727
#> 15  Fatigue<-Stress  0.08302198 0.08287014 -0.08646649  0.2525104435  1.0018322
#> 16 Fatigue<-Fatigue  0.26236046 0.08837782  0.08160752  0.4431133993  2.9686233
#>               p
#> 1  2.001209e-06
#> 2  7.963479e-01
#> 3  9.647890e-02
#> 4  4.225395e-01
#> 5  9.047940e-01
#> 6  6.641210e-05
#> 7  5.042295e-01
#> 8  6.861917e-01
#> 9  8.413027e-01
#> 10 8.473731e-01
#> 11 1.587767e-08
#> 12 6.132171e-01
#> 13 4.278311e-01
#> 14 4.856744e-02
#> 15 3.247112e-01
#> 16 5.946109e-03
coef(f)
#>       NegA<-NegA       NegA<-PosA     NegA<-Stress    NegA<-Fatigue 
#>       0.31864968       0.01308081       0.07893991       0.05277375 
#>       PosA<-NegA       PosA<-PosA     PosA<-Stress    PosA<-Fatigue 
#>      -0.00649879       0.34486455       0.04767025       0.02694751 
#>     Stress<-NegA     Stress<-PosA   Stress<-Stress  Stress<-Fatigue 
#>       0.01450827       0.01130966       0.57183741       0.03286818 
#>    Fatigue<-NegA    Fatigue<-PosA  Fatigue<-Stress Fatigue<-Fatigue 
#>      -0.08350106      -0.13066866       0.08302198       0.26236046 
confint(f, parm = "NegA<-NegA", level = 0.9)
#>                  5 %     95 %
#> NegA<-NegA 0.2271444 0.410155
nobs(f)
#> [1] 321