[R] Strange results using match and which function

2013-11-04 Thread Timo Schmid
Hello, I want to match specific numbers and a vector. Therefore I use the match or which function but I get unreasonable results. Has anybody an idea why I got a NA inmatch(0.12, tau)Please see the code below: > tau<-seq(0.02,0.98,0.02) > tau [1] 0.02 0.04 0.06 0.08 0.10 0.12 0.14 0.16 0.18 0.

[R] No speed effect by using RcppArmadillo compared to R in matrix operations

2013-10-26 Thread Timo Schmid
Hello, I am looking for a way to do fast matrix operations (multiplication, Inversion) for large matrices (n=8000) in R. I know R is not that fast in linear algebra than other software. So I wanted to write some code in C++ and incorporate this code in R. I have used the package RcppArmadillo,

[R] Incorporate Julia into R

2013-10-17 Thread Timo Schmid
Hi, I have some code in R with a lot of matrix multiplication and inverting. R can be very slow for larger matrices like 5000x5000. I have seen the new programming language Julia (www.julialang.org) which is quite fast in doing matrix algebra. So my idea is to set up the simulations in R and st

[R] SAR structure in linear mixed model in R

2012-07-26 Thread Timo Schmid
Hey, I want to estimate a spatial linear mixed model y=X\beta+Zv+e with e\sim N(0,4) and v\sim N(0,G). G is a covariance matrix of a simultaneously autoregressive model (SAR) and is given by G=\sigma_v^2((I-pW)(I-pW^T))^{-1} where p is a spatial correlation parameter and W is a matrix which desc

[R] Mathematical expressions in the group labels in lattice

2011-09-13 Thread Timo Schmid
Hi, I am working with the lattice package and I want to label to groups in the xyplots with mathematical expressions. I short example for this library(lattice) Case<-factor(rep(1:2,each=300)) xx<-rnorm(600,0,1) yy<-rnorm(600,0,1) xyplot(yy~xx|Case) This results in two scatter plots with label