[R] error in optimization when I include constant term in Klein and Spady (np package)
Dimitris.Kapetanakis
dimitrios.kapetanakis at gmail.com
Mon Jul 25 15:17:26 CEST 2011
Dear all,
I am trying to use the np package for the estimation of a model with Klein
and Spady's semiparametric estimator. When though, I include a constant term
( a column with 1s in X) then the following message appear:
Multistart 1 of 3...Error in optim(c(beta, h), fn = optim.fn, gr = NULL,
method = optim.method, :
non-finite value supplied by optim
So, how can I include a constant term in Klein and Spady's estimator or how
can I solve the problem with the optimzation? (I already tried all the
possible optimization methods)
The code that I run is:
library(np)
N<-250
q<-2
BETA<-matrix(1,3,1)
X<-matrix(c(rnorm(N,0,1), rnorm(N,1,1)), ncol=q)
X<-cbind(X,1)
L<-rlogis(N,location=0, scale=1)
Y <-as.vector(X%*%BETA+L>=0)*1
KS <- npindexbw(xdat=X, ydat=Y, bandwidth.compute=TRUE,
method="kleinspady", optim.maxit=10^3, ckertype="epanechnikov", ckerorder=2)
Thank you
Dimitris
--
View this message in context: http://r.789695.n4.nabble.com/error-in-optimization-when-I-include-constant-term-in-Klein-and-Spady-np-package-tp3692728p3692728.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list