Re: [R] Automating regression

2014-12-22 Thread Bert Gunter
.. that should have been either myProc <- function(FUN, ...) do.call(FUN,list(...)) or myProc <- function(FUN, ...) FUN(...) My other comments still apply. Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is

Re: [R] Automating regression

2014-12-22 Thread Bert Gunter
"Automate" is vague and ill-defined. But perhaps ?do.call is what you're looking for; e.g. myProc <- function(FUN, ...) do.call(FUN,...) This is one of the cool things about functional type programming -- you can pass functions as arguments. If this is not it, maybe someone else will groc what y

[R] Automating regression

2014-12-22 Thread Steven Yen
How do I specify the type of regression in calling a procedure/ In the following I call the procedure to do a probit regression. Of course, I can change "probit" into "lm" in procedure "myreg" to do a linear regression. My question is, how do I automate this (choice of lm or probit) in callin

Re: [R] automating regression or correlations for many variables

2011-04-04 Thread geral
Thanks! You are awesome! I am not sure I follow everything, but I am trying! AG -- View this message in context: http://r.789695.n4.nabble.com/automating-regression-or-correlations-for-many-variables-tp3426091p3426887.html Sent from the R help mailing list archive at Nabble.com. __

Re: [R] automating regression or correlations for many variables

2011-04-04 Thread Dennis Murphy
Hi: On Mon, Apr 4, 2011 at 1:33 PM, geral wrote: > Thanks! > > I must confess I am just a beginner, but I followed your suggestion and did > 'm <- lm(as.matrix(snp[, -1]) ~ lat, data = snp) ' and it worked > perfectly. > I would like to understand what is being done here. as.matrix I understand

Re: [R] automating regression or correlations for many variables

2011-04-04 Thread geral
Thanks! I must confess I am just a beginner, but I followed your suggestion and did 'm <- lm(as.matrix(snp[, -1]) ~ lat, data = snp) ' and it worked perfectly. I would like to understand what is being done here. as.matrix I understand makes my data frame be a matrix, but I don't understand the pa

Re: [R] automating regression or correlations for many variables

2011-04-04 Thread Dennis Murphy
Hi: Here's a small example: > df <- data.frame(y1 = rnorm(10), y2 = rnorm(10), y3 = rnorm(10), lat = rnorm(10)) > m <- lm(cbind(y1, y2, y3) ~ lat, data = df) > summary(m) The LHS of the model formula needs to be a matrix. In your case, something like m <- lm(as.matrix(snp[, -1]) ~ lat, data =

[R] automating regression or correlations for many variables

2011-04-04 Thread geral
Dear All, I have a large data frame with 10 rows and 82 columns. I want to apply the same function to all of the columns with a single command. e.g. zl <- lm (snp$a_109909 ~ snp$lat) will fit a linear model to the values in lat and a_109909. What I want to do is fit linear models for the values i