Re: [R] For loop question

2012-11-10 Thread dae
Thanks. That got me the answer. This works: symbols = c("IEF","SPY") getSymbols(symbols) for(symbol in symbols) { assign(symbol, to.monthly(get(symbol), indexAt="endof")) } #end -- View this message in context: http://r.789695.n4.nabble.com/For-loop-question-tp4649215p46492

[R] For loop question

2012-11-10 Thread dae
I have this code: IEF <- to.monthly(IEF, indexAt="endof") SPY <- to.monthly(SPY, indexAt="endof") I would like to use a for loop instead of separate entries, so the only code that needs to be modified is the list of symbols. symbols <- c("IEF", "SPY") for(symbol in symbols) { symbol <- to.m

[R] optim with simulated annealing SANN for combinatorial optimization

2011-12-15 Thread Dae-Jin Lee
Hi all I am trying to solve a combinatorial optimization problem. Basically, I can reduce my problem into the next problem: 1.- Given a NxN grid of points, with some values in each cell 2.- Find the combination of K points on the grid such that, the maximum mean value is obtained I took the Tr

[R] Lasso for k-subset regression

2011-06-05 Thread Dae-Jin Lee
Dear R-users I'm trying to use lasso in lars package for subset regression, I have a large matrix of size 1000x100 and my aim is to select a subset k of the 100 variables. Is there any way in lars to fix the number k (i.e. to select the best 10 variables) library(lars) aa=lars(X,Y,type="lasso"

Re: [R] Conditional Autoregressive (CAR) model simulation

2008-02-19 Thread Dae-Jin Lee
corr_x # cor(a_x,lag(col.W,a_x)) [,1] [1,] 0.06929324 # == I don't know if I'm simulating correctly the CAR, any help? Thanks in advance 2008/2/15, Henrique Dallazuanna <[EMAIL PROTECTED]>: > > See spautolm

[R] Conditional Autoregressive (CAR) model simulation

2008-02-15 Thread Dae-Jin Lee
library, but this is not what I'm looking for Thanks in advance Dae-Jin -- ______ Dae-Jin Lee Office/Despacho: 7.3.J04 Phone/Tlfno:+34 91 624 9175 Fax: +34 91 624 9430 Departamento de Estadística Av. Universidad 30, Ed. Juan Benet 28911 Leganés (Madrid), SPA

[R] mcv package gamm function Error in chol(XVX + S)

2007-10-02 Thread Dae-Jin Lee
Hi all R users ! I'm using gamm function from Simon Wood's mgcv package, to fit a spatial regression Generalized Additive Mixed Model, as covariates I have the geographical longitude and latitude locations of indexed data. I include a random effect for each district (dist) so the code is fit <- g