| Library: | plm |
| See also: | plmlorg plmp |
| Macro: | plmk | |
| Description: | plmk estimates the parameter part in partially linear models by using kernel to approximate the nonparametric part |
| Usage: | res = plmk(x,t,y,h) | |
| Input: | ||
| x | n x p matrix, the design | |
| t | n x 1 matrix, the design in [0, 1] | |
| y | n x 1 matrix, the response | |
| h | p x 1 matrix or scalar, chosen bandwidth | |
| Output: | ||
| res.hbeta | p x 1 matrix, estimate of parameter | |
| res.hsigma | scalar, estimate of variance | |
| res.hg | n x 1 matrix, estimate of nonparameter function | |
library("plm")
n = 100
sig=0*matrix(3,3)
sig[,1]=#(0.81,0.1,0.2)
sig[,2]=#(0.1,2.25,0.1)
sig[,3]=#(0.2,0.1,1)
x =normal(n,3)*sig
t =sort(uniform(n))
beta0=#(1.2, 1.3, 1.4) ; the true value
y =x*beta0+t^3+0.01*normal(n)
h =0.5
res=plmk(x,t,y,h)
res.hbeta ; the estimate of beta
res.hsigma ; the estimate of the variance when error is homoscedastic
ddp=createdisplay(1,1)
datah1=t~t^3
datah2=t~res.hg
part=grid(1,1,rows(t))'
setmaskp(datah1,1,0,1)
setmaskp(datah2,4,0,3)
setmaskl(datah1,part,1,1,1)
setmaskl(datah2,part,4,1,3)
show(ddp,1,1,datah1,datah2)
setgopt(ddp,1,1,"xlabel","T","title","Simulation comparison","ylabel","g(T) and its estimate values")
The parameter estimates, see Jiti Gao, Shengyan Hong and Hua Liang" Convergence rate in partly linear models", Acta Mathematical Sinica (1995) 17, 170-180.
| Library: | plm |
| See also: | plmlorg plmp |