Re: [R] Use apply only on non-missing values

2010-06-03 Thread Doran, Harold
, whether it works on my real world problem is TBD. It is running now, slowly. From: Joris Meys [mailto:jorism...@gmail.com] Sent: Wednesday, June 02, 2010 7:35 PM To: Doran, Harold Cc: r-help@r-project.org Subject: Re: [R] Use apply only on non-missing values Not really a direct answer on your question

Re: [R] Use apply only on non-missing values

2010-06-02 Thread Joris Meys
Not really a direct answer on your question, but: > system.time(replicate(1,apply(as.matrix(theta), 1, rasch, b_vector))) user system elapsed 4.510.034.55 > system.time(replicate(1,theta%*%t(b_vector))) user system elapsed 0.250.000.25 It does make a differen

[R] Use apply only on non-missing values

2010-06-02 Thread Doran, Harold
I have a function that I am currently using very inefficiently. The following are needed to illustrate the problem: set.seed(12345) dat <- matrix(sample(c(0,1), 110, replace = TRUE), nrow = 11, ncol=10) mis <- sample(1:110, 5) dat[mis] <- NA theta <- rnorm(11) b_vector <- runif(10, -4,4) empty <-