x1<-rnorm(20);x2<-rnorm(20);x3<-rnorm(20);y<-rnorm(20);z1<-rnorm(20);
l35<-lm(y~x1+x2+x3)
nlWaldtest(l35,"a[2]^3+a[3]*a[1]",0)
# Require {sandwich}
nlWaldtest(l35,c("a[2]+a[3]^4","a[1]+a[2]^2"),c(1,0),vcovHC(l35))
# Require {forecast}
ddd<-ts(data.frame(y,x1,x2,x3))
tl35<-tslm(y~x1+x2+x3,data=ddd)
nlWaldtest(tl35,"b[2]^3+b[3]*b[1]",0)
# Require {nlme}
gl35<-gls(y~x1+x2+x3,corr = corARMA(p = 1, q = 0))
nlWaldtest(gl35,"ab[2]^3+ab[3]*ab[1]",0)
# Require {forecast}
al35<-auto.arima(y,xreg=cbind(x1,x2,x3))
nlWaldtest(al35,"a[2]^3+a[3]*a[1]",0)
# Require {forecast}
Arl35<-Arima(y,order=c(1,0,0),xreg=cbind(x1,x2,x3))
nlWaldtest(Arl35,"a[4]^3+a[5]*a[3]",0)
arl35<-arima(y,order=c(1,0,0),xreg=cbind(x1,x2,x3))
nlWaldtest(arl35,"a[4]^3+a[5]*a[3]",0)
# Require {AER}, {sandwich}
il35<-ivreg(y~x1+x2+x3|x2+x3+z1)
nlWaldtest(il35,"a[2]^3+a[3]*a[1]",0,vcovHC(il35))
# Reproduce example in EVievs 8 Users Guide II, pp. 149-151.
# Require {nlme}
nl1<-nls(log(q)~c1+c2*log(c3*(k^c4)+(1-c3)*(l^c4)),
data=CESdata,start=list(c1=-2.6,c2=1.8,c3=0.0001,c4=-6),
nls.control(maxiter = 100, tol = 1e-05,minFactor = 1/2^15))
nlWaldtest(nl1,"b[2]-1/b[4]",0)
nlWaldtest(nl1,"b[2]*b[4]",1)
Run the code above in your browser using DataLab