Saturday, January 28, 2012

R draw ellipse

 1
 2 <- 100;
 3 <- numeric(N);
 4 <- numeric(N);
 5 x[1] <- -100;
 6 y[1] <- -100;
 7 for (in 2:N) {
 8   x[i] <- rnorm(1, 2 + (y[i - 1] - 3) / 6, sqrt(115 / 3))
 9   y[i] <- rnorm(1, 3 + (x[i] - 2) / 4, sqrt(115 / 2))
10 }
11 library(mixtools)
12 plot(y ~ x);
13 mu <- c(2, 3);
14 Sigma <- matrix(c(40, 10, 10, 60), ncol = 2)
15 ellipse(mu, Sigma);
16 

Tuesday, January 24, 2012

detailed explanation of interp.lin in bugs/jags

Essentially, vector x and y define a line connects all the dots [dot i
is (x_i, y_i)].  The function give the y-coordinate for any x-coordinate given
by argument e. 


Thursday, January 12, 2012

matrix to vector by row of by col in R

m <- matrix(....) 
as.vector(m)   # by column 
as.vector(t(m)) # by row 

Monday, January 9, 2012

Grep Recursively Through Single File Extension


grep tab

After some searching I found out the answer is to not use \t but to use Ctrl-v and then the <tab> key to put the tab character directly in the command. Odd. So it looks like:
 grep -R "   $" *
where the tab character is inserted as Ctrl-v and then Tab.



Sunday, January 8, 2012

See Where a Package is Installed on Ubuntu

copied from
http://www.howtogeek.com/howto/ubuntu/see-where-a-package-is-installed-on-ubuntu/

 

See Where a Package is Installed on Ubuntu

Once you use the apt-get utility to install a package, sometimes it seems to disappear into nowhere. You know it's installed, you just have no idea where.

If you know the name of the executable, you can use the which command to find the location of the binary, but that doesn't give you information on where the supporting files might be located.

There's an easy way to see the locations of all the files installed as part of the package, using the dpkg utility.

dpkg -L <packagename>

Tuesday, January 3, 2012

use gs to reduce pdf size somehow

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf a.pdf