View source: R/bootstrap-inference.R

test_f | R Documentation |

This function conducts a test of overall equality of two nonlinear functions and generates confidence bands for the estimated difference of the nonlinear functions using a bootstrap method.

```
test_f(
x,
y,
series,
t,
name_group_var,
plsmm_output,
n_boot = 1000,
predicted = FALSE,
show_obs = FALSE,
verbose = TRUE
)
```

`x` |
A matrix of predictors. |

`y` |
A continuous vector of response variable. |

`series` |
A variable representing different series or groups in the data modeled as a random intercept. |

`t` |
A numeric vector indicating the time points. |

`name_group_var` |
A character string specifying the name of the grouping variable. |

`plsmm_output` |
Output object obtained from the |

`n_boot` |
Numeric specifying the number of bootstrap samples (default is 1000). |

`predicted` |
Logical indicating whether to plot predicted values. If |

`show_obs` |
Logical. If |

`verbose` |
Logical indicating whether to display bootstrap progress. Default is |

The function generate bootstrap samples and estimate the nonlinear functions for each `n_boot`

sample.
These bootstrap estimates are then used to compute the L2-norm test of equality and the joint confidence bands.

A plot showing the estimated difference and confidence bands of the nonlinear functions.

A list containing:

`overall_test_results` |
Results from the L2-norm test of equality. |

`CI_f` |
Confidence intervals values for the difference of the estimated functions used for plotting. |

```
set.seed(123)
data_sim <- simulate_group_inter(
N = 50, n_mvnorm = 3, grouped = TRUE,
timepoints = 3:5, nonpara_inter = TRUE,
sample_from = seq(0, 52, 13),
cos = FALSE, A_vec = c(1, 1.5)
)
sim <- data_sim$sim
x <- as.matrix(sim[, -1:-3])
y <- sim$y
series <- sim$series
t <- sim$t
bases <- create_bases(t)
lambda <- 0.0046
gamma <- 0.00000001
plsmm_output <- plsmm_lasso(x, y, series, t,
name_group_var = "group", bases$bases,
gamma = gamma, lambda = lambda, timexgroup = TRUE,
criterion = "BIC"
)
test_f_results <- test_f(x, y, series, t,
name_group_var = "group", plsmm_output,
n_boot = 10
)
test_f_results[[1]]
test_f_results[[2]]
```

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.