[R] glm (probit/logit) optimizer

2012-10-05 Thread Dimitris.Kapetanakis
Dear all, I am using glm function in order to estimate a logit model i.e. glm(Y ~ data[,2] + data[,3], family = binomial(link = "logit")). I also created a function that estimates logit model and I would like it to compare it with the glm function. So, does anyone know what optimizer or optimi

[R] Local linear regression

2012-03-28 Thread Dimitris.Kapetanakis
Dear all, I wrote a code which supposedly should create a function which performs a local linear regression at point x (lower case). The issue is that I have no reference to check if indeed my code performs correctly a local linear regression. Is there any function in R that performs a local lin

[R] Constraint optimization containing constraints with absolute values

2012-03-24 Thread Dimitris.Kapetanakis
Dear all, I would like to use constraint optimization routine but with the constraint containing absolute values of the arguments. For example I would like to maximize a log-likelihood function (loglik) wrt b where b is a vector of length=2 with the constraint abs(b[1])+abs(b[2])=2. The uncons

[R] integrate (error: evaluation of function gave a result of wrong length)

2012-02-15 Thread Dimitris.Kapetanakis
Dear all, I am trying to use the integrate function in R but it seems that it does not work in my example and I cannot figure out why. I create a function Mu1 (which works fine) and try to integrate by the code: n <- 100 Ctrl<- as.matrix(cbind(runif(n, -30, 30))) W

[R] Local regression

2012-01-25 Thread Dimitris.Kapetanakis
Dear all, I would like to use local (most probably linear) regression. What I am interested though is not plot the data but to use the result as a function. For example I would like to use it for numerical integration or optimization with respect to a regressor. Do you know if there is a package t

[R] sum of functions

2011-10-06 Thread Dimitris.Kapetanakis
Dear all, I would like to create a code for semiparametric Klein and Spady's estimator. For that I created a function that provides the log-likelihood function for each observation (so it is a function of betas and i, where i denotes the observation). Now, in order to maximize the log-likelihood f

Re: [R] memory problem; Error: cannot allocate vector of size 915.5 Mb

2011-08-01 Thread Dimitris.Kapetanakis
Thanks a lot for the help. Actually, I am using a mac which (R for Mac OS X GUI 1.40-devel Leopard build 32-bit (5751)) but I think I can find access on windows 7 64-bit. What I am trying to do is a maximization through grid search (because I am not sure that any of the optim() methods works suff

[R] memory problem; Error: cannot allocate vector of size 915.5 Mb

2011-07-31 Thread Dimitris.Kapetanakis
Dear all, I am trying to make some matrix operations (whose size I think is smaller than what R allows) but the operations are not feasible when they run in one session but it is feasible if they run separately while each operation is totally independent of the other. I run the code in one session

[R] error in optimization when I include constant term in Klein and Spady (np package)

2011-07-25 Thread Dimitris.Kapetanakis
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, m

[R] np package, KleinSpady estimator, error when I estimate the bootstrapped standard errors

2011-07-20 Thread Dimitris.Kapetanakis
Dear all, I am using np package in order to estimate a model with Klein and Spady estimator. To estimate the model I use KS <- npindexbw (xdat=X, ydat=Y, bandwidth.compute=TRUE, method="kleinspady", optim.maxit=10^3, ckertype="epanechnikov", ckerorder=2) and to estimate beta hats standard error

[R] np package, estimating the standard errors of Klein and Spady's estimator

2011-07-18 Thread Dimitris.Kapetanakis
Dear all, I would like to estimate the standard errors of Klein and Spady's estimator for that I am using: library(np) N<-100 X<-matrix(c(rnorm(N,1,1), rnorm(N,0,1)), ncol=2) BETA <-matrix(1,2,1) Z<-X%*%BETA L<-rlogis(N,location=0, scale=1) Y <-as.vector(X%*%BETA+L>=0)*1 KS <- npindexbw (xda

[R] constrained logit (logistic regression) estimatrion

2011-07-16 Thread Dimitris.Kapetanakis
Dear all, Is there a way to estimate a constrained binary logit model (logistic regression). For example if I have y~x1 x2 x3 to restrict the constant to be constant=0 and the coefficient of x1 beta1=1? Thank you Dimitris -- View this message in context: http://r.789695.n4.nabble.com/constra

[R] Smoothed Maximum Score estimator

2011-07-13 Thread Dimitris.Kapetanakis
Dear all, Does exist a function for the semiparametric Smoothed Maximum score estimator of Horowitz (1992) or Klein and Spady's (1993) estimator? Thank you Dimitris -- View this message in context: http://r.789695.n4.nabble.com/Smoothed-Maximum-Score-estimator-tp3664288p3664288.html Sent from

[R] apply (or similar preferred) for multiple columns

2011-07-12 Thread Dimitris.Kapetanakis
Dear all, I would like to use the apply or a similar function belonging to this family, but applying for each column (or row) but let say for each q columns. For example I would like to apply a function FUN for the first q columns of matrix X then for q+1:2*q and so on. If I do apply (X, 2, FUN)

[R] Matrix operation with apply family functions

2011-07-11 Thread Dimitris.Kapetanakis
Dear all, I am trying to use the apply family functions to improve the efficiency of my code, though it is a bit hard for me to find sometimes the solutions with these functions. The problem that I want to solve is: I have a matrix of replicated random generated data, e.g. if I have two control

[R] apply family functions (tapply, sapply, mapply etc)

2011-07-07 Thread Dimitris.Kapetanakis
Dear all, I am trying to use apply or similar functions in order to improve the efficiency of my code but I guess I am misunderstanding the function of these commands. What I want to do is possible to see with the following code that I use a for loop command. In words what I want to do are two thi

[R] rearrange command in quantreg package

2010-10-10 Thread Dimitris.Kapetanakis
Dear all, I want to use the "rearrange" command which is based on Chernozhukov et al paper and is included in the quantreg package. So, I run a quantile regression in which I included dummy variables for state and years in order to estimate the respective fixed effects quantile regression. The p