join_flipscores.Rdjointest for flipscores objects
join_flipscores(
mods,
tested_coeffs = NULL,
n_flips = 5000,
score_type = "standardized",
statistics = "t",
seed = NULL
)is a list of the same length of mods, each element of the list being a vector of
of names of tested coefficients. Alternatively, it can be a vector of names of tested coefficients, in this case, the tested coefficients are attributed to all models (when present).
As a last option, it can be NULL, if so, all coefficients are tested.
n=20
set.seed(123)
D=data.frame(X=rnorm(n),Z1=rnorm(n),Z2=rnorm(n))
D$Y=D$Z1+D$X+rnorm(n)
mod1=glm(Y~X+Z1+Z2,data=D)
mod2=glm(Y~X+poly(Z1,2)+Z2,data=D)
mod3=glm(Y~X+poly(Z1,2)+poly(Z2,2),data=D)
mod4=glm(Y~X+Z1+poly(Z2,2),data=D)
mods=list(mod1=mod1,mod2=mod2,mod3=mod3,mod4=mod4)
for(i in 1:length(mods))
mods[[i]]$call$data=eval(D)
library(jointest)
res=join_flipscores(mods,n_flips = 5000, score_type = "standardized" ,
seed = 1, tested_coeffs = "X")
summary(res)
#> Model Coeff Estimate Score Std. Error z value Part. Cor Pr(>|t|)
#> 1 mod1 X 1.1254046 19.78375 6.309305 3.135646 0.7605058 0.01599680
#> 2 mod2 X 0.9552644 15.38036 5.053879 3.043278 0.7608195 0.01299740
#> 3 mod3 X 1.0121921 14.31866 4.836669 2.960437 0.7643816 0.01339732
#> 4 mod4 X 1.1696906 17.62979 5.875380 3.000621 0.7501552 0.01339732
summary(combine(res))
#> Coeff Stat nMods S p
#> 1 X maxT 4 19.78375 0.01679664
res=p.adjust.fwer(res)
summary(res)
#> Model Coeff Estimate Score Std. Error z value Part. Cor Pr(>|t|)
#> 1 mod1 X 1.1254046 19.78375 6.309305 3.135646 0.7605058 0.01599680
#> 2 mod2 X 0.9552644 15.38036 5.053879 3.043278 0.7608195 0.01299740
#> 3 mod3 X 1.0121921 14.31866 4.836669 2.960437 0.7643816 0.01339732
#> 4 mod4 X 1.1696906 17.62979 5.875380 3.000621 0.7501552 0.01339732
#> p.adj
#> 1 0.01679664
#> 2 0.01679664
#> 3 0.01679664
#> 4 0.01679664