[R] gl1ce warning message?

From: Mike Wolfgang <mikewolfgang_at_gmail.com>
Date: Tue 22 Aug 2006 - 14:19:18 EST


I am trying to write a function to do Lasso regression on my data:

mylasso<-function(data,k){
  gcvs<-rep(0,k)
  for (i in 1:k){
    temp.lasso<-gl1ce(as.formula(paste("y ~ ",paste(colnames(data)[-1],collapse='+'))),

    data=data.frame(data),family=binomial(),bound=i/k)     gcvs[k]<-gcv(temp.lasso)[2]
  }
  return(gcvs)
}

as I execute my function with some data, I get these messages: Warning messages:
1: `x' and `y' have different environments; x's is used in: merge.formula(formula,
sweep.out)
...

But as I execute commands within this simple function line by line, no warnings are produced. I suspect the data argument should be treated specially but don't know how to. Can anybody give me a solution or hint? Thanks a lot,

Mike

        [[alternative HTML version deleted]]



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue Aug 22 15:46:59 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Tue 22 Aug 2006 - 18:21:48 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.