From a sample {(Y_i, X_{i1}, ..., X_{ip}, t_i): i=1,...,n}, this routine tests the null hypotheses H_0: β=β_0 and H_0: m=m_0, where:
β = (β_1,...,β_p)
is an unknown vector parameter,
m(.)
is a smooth but unknown function and
Y_i= X_{i1}*β_1 +...+ X_{ip}*β_p + m(t_i) + ε_i.
Fixed equally spaced design is considered for the "nonparametric" explanatory variable, t, and the random errors, ε_i, are allowed to be time series. The test statistic used for testing H0: β = β_0 derives from the asymptotic normality of an estimator of β based on both ordinary least squares and kernel smoothing (this result giving a χ^2test). The test statistic used for testing H0: m = m_0 derives from a CramervonMisestype functional distance between a nonparametric estimator of m and m_0.
1 2 3 4 5 
data 
X_1, ... X_p;

beta0 
the considered parameter vector in the parametric null hypothesis. If 
m0 
the considered function in the nonparametric null hypothesis. If 
b.seq 
the statistic test for H0: β=β_0 is performed using each bandwidth in the vector 
h.seq 
the statistic test for H0: m=m_0 is performed using each pair of bandwidths ( 
w 
support interval of the weigth function in the test statistic for H0: m = m_0. If 
estimator 
allows us the choice between “NW” (NadarayaWatson) 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”. 
time.series 
it denotes whether the data are independent (FALSE) or if data is a time series (TRUE). The default is FALSE. 
Var.Cov.eps 

Tau.eps 
it contains the sum of autocovariances 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 sum of the autocovariances of such ARMA model. 
b0 
if 
h0 
if 
lag.max 
if 
p.max 
if 
q.max 
if 
ic 
if 
num.lb 
if 
alpha 
if 
A weight function (specifically, the indicator function 1_{[w[1] , w[2]]}) is introduced in the test statistic for testing H0: m = m_0 to allow elimination (or at least significant reduction) of boundary effects from the estimate of m(t_i).
If Var.Cov.eps=NULL
and the routine is not able to suggest an approximation for Var.Cov.eps
, it warns the user with a message saying that the model could be not appropriate and then it shows the results. In order to construct Var.Cov.eps
, the procedure suggested in AneirosPerez and Vieu (2013) can be followed.
If Tau.eps=NULL
and the routine is not able to suggest an approximation for Tau.eps
, it warns the user with a message saying that the model could be not appropriate and then it shows the results. In order to construct Tau.eps
, the procedures suggested in AneirosPerez (2008) can be followed.
The implemented procedures generalize those ones in expressions (9) and (10) in GonzalezManteiga and AneirosPerez (2003) by allowing some dependence condition in {(X_{i1}, ..., X_{ip}): i=1,...,n} and including a weight function (see above), respectively.
A list with two dataframes:
parametric.test 
a dataframe containing the bandwidths, the statistics and the pvalues when one tests H0: β = β_0 
nonparametric.test 
a dataframe containing the bandwidths b and h, the statistics, the normalised statistics and the pvalues when one tests H0: m = m_0 
Moreover, if data
is a time series and Tau.eps
or Var.Cov.eps
are not especified:
pv.Box.test 
pvalues of the LjungBox test for the model fitted to the residuals. 
pv.t.test 
pvalues of the t.test for the model fitted to the residuals. 
ar.ma 
ARMA orders for the model fitted to the residuals. 
German Aneiros Perez ganeiros@udc.es
Ana Lopez Cheda ana.lopez.cheda@udc.es
AneirosPerez, G. (2008) Semiparametric analysis of covariance under dependence conditions within each group. Aust. N. Z. J. Stat. 50, 97123.
AneirosPerez, G., GonzalezManteiga, W. and Vieu, P. (2004) Estimation and testing in a partial linear regression under longmemory dependence. Bernoulli 10, 4978.
AneirosPerez, G. and Vieu, P. (2013) Testing linearity in semiparametric functional data analysis. Comput. Stat. 28, 413434.
Gao, J. (1997) Adaptive parametric test in a semiparametric regression model. Comm. Statist. Theory Methods 26, 787800.
GonzalezManteiga, W. and AneirosPerez, G. (2003) Testing in partial linear regression models with dependent errors. J. Nonparametr. Statist. 15, 93111.
Other related functions are plrm.est
, par.gof
and np.gof
.
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  # EXAMPLE 1: REAL DATA
data(barnacles1)
data < as.matrix(barnacles1)
data < diff(data, 12)
data < cbind(data,1:nrow(data))
plrm.gof(data)
plrm.gof(data, beta0=c(0.1, 0.35))
# EXAMPLE 2: SIMULATED DATA
## Example 2a: dependent data
set.seed(1234)
# We generate the data
n < 100
t < ((1:n)0.5)/n
beta < c(0.05, 0.01)
m < function(t) {0.25*t*(1t)}
f < m(t)
f.function < function(u) {0.25*u*(1u)}
x < matrix(rnorm(200,0,1), nrow=n)
sum < x%*%beta
epsilon < arima.sim(list(order = c(1,0,0), ar=0.7), sd = 0.01, n = n)
y < sum + f + epsilon
data < cbind(y,x,t)
## Example 2a.1: true null hypotheses
plrm.gof(data, beta0=c(0.05, 0.01), m0=f.function, time.series=TRUE)
## Example 2a.2: false null hypotheses
plrm.gof(data, time.series=TRUE)

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
Please suggest features or report bugs with the GitHub issue tracker.
All documentation is copyright its authors; we didn't write any of that.