# plrm.ci: Confidence intervals estimation in partial linear regression... In PLRModels: Statistical inference in partial linear regression models

## Description

This routine obtains a confidence interval for the value a^T * β, by asymptotic distribution and bootstrap, {(Y_i, X_{i1}, ..., X_{ip}, t_i): i=1,...,n}, where:

a = (a_1,...,a_p)^T

is an unknown vector,

β = (β_1,...,β_p)^T

is an unknown vector parameter and

Y_i= X_{i1}*β_1 +...+ X_{ip}*β_p + m(t_i) + ε_i.

The nonparametric component, m, is a smooth but unknown function, and the random errors, ε_i, are allowed to be time series.

## Usage

 ```1 2 3 4 5``` ```plrm.ci(data=data, seed=123, CI="AD", B=1000, N=50, a=NULL, b1=NULL, b2=NULL, estimator="NW", kernel="quadratic", p.arima=NULL, q.arima=NULL, p.max=3, q.max=3, alpha=0.05, alpha2=0.05, num.lb=10, ic="BIC", Var.Cov.eps=NULL) ```

## Arguments

 `data` `data[, 1]` contains the values of the response variable, Y; `data[, 2:(p+1)]` contains the values of the "linear" explanatory variables, X_1, ..., X_p; `data[, p+2]` contains the values of the "nonparametric" explanatory variable, t. `seed` the considered seed. `CI` method to obtain the confidence interval. It allows us to choose between: “AD” (asymptotic distribution), “B” (bootstrap) or “all” (both). The default is “AD”. `B` number of bootstrap replications. The default is 1000. `N` Truncation parameter used in the finite approximation of the MA(infinite) expression of ε. `a` Vector which, multiplied by `beta`, is used for obtaining the confidence interval of this result. `b1` the considered bandwidth to estimate the confidence interval by asymptotic distribution. If NULL (the default), it is obtained using cross-validation. `b2` the considered bandwidth to estimate the confidence interval by bootstrap. If NULL (the default), it is obtained using cross-validation. `estimator` allows us the choice between “NW” (Nadaraya-Watson) or “LLP” (Local Linear Polynomial). The default is “NW”. `kernel` allows us the choice between “gaussian”, “quadratic” (Epanechnikov kernel), “triweight” or “uniform” kernel. The default is “quadratic”. `p.arima` the considered p to fit the model ARMA(p,q). `q.arima` the considered q to fit the model ARMA(p,q). `p.max` if `Var.Cov.eps=NULL`, the ARMA models are selected between the models ARMA(p,q) with 0<=p<=`p.max` and 0<=q<=`q.max`. The default is 3. `q.max` if `Var.Cov.eps=NULL`, the ARMA models are selected between the models ARMA(p,q) with 0<=p<=`p.max` and 0<=q<=`q.max`. The default is 3. `alpha` 1 - `alpha` is the confidence level of the confidence interval. The default is 0.05. `alpha2` significance level used to check (if needed) the ARMA model fitted to the residuals. The default is 0.05. `num.lb` if `Var.Cov.eps=NULL`, it checks the suitability of the selected ARMA model according to the Ljung-Box test and the t-test. It uses up to `num.lb` delays in the Ljung-Box test. The default is 10. `ic` if `Var.Cov.eps=NULL`, `ic` contains the information criterion used to suggest the ARMA model. It allows us to choose between: "AIC", "AICC" or "BIC" (the default). `Var.Cov.eps` `n x n` matrix of variances-covariances associated to the random errors of the regression model. If NULL (the default), the function tries to estimate it: it fits an ARMA model (selected according to an information criterium) to the residuals from the fitted regression model and, then, it obtains the var-cov matrix of such ARMA model.

## Value

A list containing:

 `Bootstrap` a dataframe containing `ci_inf` and `ci_sup`, the confidence intervals using bootstrap; `p_opt` and `q_opt` (the orders for the ARMA model fitted to the residuals) and `b1` and `b2`, the considered bandwidths. `AD` a dataframe containing `ci_inf` and `ci_sup`, the confidence intervals using the asymptotic distribution; `p_opt` and `q_opt` (the orders for the ARMA model fitted to the residuals) and `b1`, the considered bandwidth. `pv.Box.test` p-values of the Ljung-Box test for the model fitted to the residuals. `pv.t.test` p-values of the t.test for the model fitted to the residuals.

## Author(s)

German Aneiros Perez [email protected]

Ana Lopez Cheda [email protected]

## References

Liang, H., Hardle, W., Sommerfeld, V. (2000) Bootstrap approximation in a partially linear regression model. Journal of Statistical Planning and Inference 91, 413-426.

You, J., Zhou, X. (2005) Bootstrap of a semiparametric partially linear model with autoregressive errors. Statistica Sinica 15, 117-133.

A related functions is `par.ci`.
 ``` 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 36``` ```# EXAMPLE 1: REAL DATA data(barnacles1) data <- as.matrix(barnacles1) data <- diff(data, 12) data <- cbind(data,1:nrow(data)) b.h <- plrm.gcv(data)\$bh.opt b1 <- b.h[1] ## Not run: plrm.ci(data, b1=b1, b2=b1, a=c(1,0), CI="all") ## Not run: plrm.ci(data, b1=b1, b2=b1, a=c(0,1), CI="all") # EXAMPLE 2: SIMULATED DATA ## Example 2a: dependent data set.seed(123) # We generate the data n <- 100 t <- ((1:n)-0.5)/n m <- function(t) {t+0.5} f <- m(t) beta <- c(0.5, 2) x <- matrix(rnorm(200,0,3), nrow=n) sum <- x%*%beta sum <- as.matrix(sum) eps <- arima.sim(list(order = c(1,0,0), ar=0.7), sd = 0.1, n = n) eps <- as.matrix(eps) y <- sum + f + eps data_plrmci <- cbind(y,x,t) ## Not run: plrm.ci(data, a=c(1,0), CI="all") ## Not run: plrm.ci(data, a=c(0,1), CI="all") ```