postOBSP_CI: Post-OBSP confidence intervals (CI)

Description Usage Arguments Details Value Examples

View source: R/postOBSP_CI.R

Description

Function postOBSP_CI provides post-OBSP confidence intervals for mixed parameters

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
postOBSP_CI(
  X,
  y,
  clusterID,
  X_cluster_full = NULL,
  model = "NERM",
  covariate_selection_matrix = NULL,
  modelset = "all_subsets",
  intercept = FALSE,
  common = NULL,
  boot = 1000,
  alpha = 0.05
)

Arguments

X

Matrix with covariates for fixed effects

y

Vector of responses

clusterID

Vector with cluster labels

X_cluster_full

Matrix with cluster level covariates for fixed effects of the full model. Default: NULL

model

Type of mixed model: NERM, FHM, RIRS (random slopes and random intercepts)

covariate_selection_matrix

Matrix composed of zeros and ones indicating fixed models in each parameter. Default: NULL

modelset

Type of model set:

  • "all_subsets" - all possible models using all covariates

  • "nested" - a sequence of nested models using all covariates

  • "part_subset" - all possible models using a subset of covariates

intercept

Is column of ones, representing the intercept, present in X Default: TRUE

common

A vector indicating variables forced to be present in each model. Default: NULL

boot

Number of bootstrap samples. Default: boot = 1000

alpha

Construct 1 - alpha confidence intervals. Default: alpha = 0.05

Details

Parameter boot is needed for the calculation of the bootstrap post-OBSP MSE of mixed effects.

Value

List with elements:

OBSP_min

Index of the selected model

OBSP_models

cAIC for all considered parameters

postOBSP_up

Upper boundary of CI for mixed effects

postOBSP_do

Lower boundary of CI for mixed effects

mu_hat_sel

Mixed effects of the selected model

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
# Define basic parameters -------------------------------------------------
n = 15
m_i = 5
m_total = n * m_i

beta = c(2.25, -1.1, 2.43, rep(0, 2))
sig_e = 1
sig_u = 1

X = simulations_n15_mi5
X_intercept = cbind(rep(1, m_total), X)

clusterID = rep(1:n, each = m_i)

# Create responses, errors and random effects  -------------------
e_ij = rnorm(m_total, 0, sig_e)

u_i = rnorm(n, 0, sig_u)
u_i_aug = rep(u_i, each = m_i)

y = X_intercept%*% beta + u_i_aug + e_ij

# Post-OBSP inference ----------------------------------------

postOBSP_CI_results = postOBSP_CI(X, y,
                                  clusterID,
                                  X_cluster_full = NULL,
                                  model = "NERM",
                                  covariate_selection_matrix = NULL,
                                  modelset  = "part_subset",
                                  intercept = FALSE,
                                  common = c(1:2),
                                  boot = 250)
                                  
plot(postOBSP_CI_results)                                   

KatarzynaReluga/postcAIC documentation built on Jan. 25, 2022, 12:33 a.m.