haotu : an open lab notebook

2010/05/23

Scatterplot variations

Filed under: R — S @ 22:13

The car package can condition the scatterplot matrix on a factor, and optionally include lowess and linear best fit lines, and boxplot, densities, or histograms in the principal diagonal, as well as rug plots in the margins of the cells.

# Scatterplot Matrices from the car Package
library(car)
scatterplot.matrix(~mpg+disp+drat+wt|cyl, data=mtcars,
main="Three Cylinder Options")

The lattice package provides options to condition the scatterplot matrix on a factor.

# Scatterplot Matrices from the lattice Package
library(lattice)
splom(mtcars[c(1,3,5,6)], groups=cyl, data=mtcars,
panel=panel.superpose,
key=list(title="Three Cylinder Options",
columns=3,
points=list(pch=super.sym$pch[1:3],
col=super.sym$col[1:3]),
text=list(c("4 Cylinder","6 Cylinder","8 Cylinder"))))

The gclus package provides options to rearrange the variables so that those with higher correlations are closer to the principal diagonal. It can also color code the cells to reflect the size of the correlations.

# Scatterplot Matrices from the glus Package
library(gclus)
dta <- mtcars[c(1,3,5,6)] # get data
dta.r <- abs(cor(dta)) # get correlations
dta.col <- dmat.color(dta.r) # get colors
# reorder variables so those with highest correlation
# are closest to the diagonal
dta.o <- order.single(dta.r)
cpairs(dta, dta.o, panel.colors=dta.col, gap=.5,
main="Variables Ordered and Colored by Correlation" )

http://www.statmethods.net/graphs/scatterplot.html

2010/05/19

Brackets Cutoff in Equation Editor

Filed under: Microsoft Products — S @ 00:33

The top of brackets and parentheses can be cutoff in equation editor

http://kbalertz.com/269568/Square-Brackets-Subscript-Superscript-Template.aspx

Go to Format->Spacing and then adjust the “Fence overhang” parameter to fix this problem.

2010/05/18

International Purchasing Power

Filed under: Misc — S @ 21:49

http://en.wikipedia.org/wiki/Big_Mac_Index

http://en.wikipedia.org/wiki/Purchasing_power_parity

http://pwt.econ.upenn.edu/php_site/pwt_index.php

country

country isocode year PPP
China Version 1 CHN 2007 2.21
China Version 2 CH2 2007 2.42
United States USA 2007 1.00

2010/05/08

Installing R Packages Windows 7

Filed under: R — S @ 19:03

Here is how I did it. I am not certain if it is the best or if I actually needed to do all the following steps, but it worked.

1. Make sure that you have the built in Administrator account enabled. Go to Run, type lusrmgr.msc hit enter, go to “users” then “Administrator”, make sure that the “account is disabled” checkbox is not checked. You will have to restart your computer

2. log in on the  Administrator acccount.

3. go to “Control Panel”–>”User Accounts and Family Safety”–> “User Accounts”–>”Change my environmental variables” (on left).

4. Under system variables click “New…”

5. For variable name type R_LIBS then for variable value type the path you want the packages installed to (e.g., C:\Program Files\R\R-2.11.0\library)

6. You may have to do this for User variable for Administrator too…

http://www.howtogeek.com/howto/windows-vista/enable-the-hidden-administrator-account-on-windows-vista/

http://cran.r-project.org/bin/windows/base/rw-FAQ.html#Does-R-run-under-Windows-Vista_003f

http://cran.r-project.org/bin/windows/base/rw-FAQ.html#How-do-I-set-environment-variables_003f

http://cran.r-project.org/bin/windows/base/rw-FAQ.html#I-don_0027t-have-permission-to-write-to-the-R_002d2_002e11_002e0_005clibrary-directory

http://www.sevenforums.com/tutorials/507-built-administrator-account-enable-disable.html

2010/05/05

R Ubuntu Installation Tips

Filed under: R — S @ 18:49

http://www.keittlab.org/node/158

The R program is available in Ubuntu. You can install it by choosing r-base-dev from synaptic. Use the menus System -> Administration -> Synaptic package manager.

The version in Ubuntu will generally be out-of-date rather quickly, so you will want to add the CRAN repository. That will keep you up to date. You can do this using the Ubuntu menus. Open: System -> Administration -> Software sources and choose the Other Softwaretab. Click the Add… button and enter:

deb http://cran.stat.ucla.edu/bin/linux/ubuntu lucid/

The packages on the CRAN repository are digitally signed by the packager to ensure that no one is feeding you a trojan horse. It will make installation smoother if you download and install the corresponding public key. Save the text of the key in a file on your desktop. Then run the Software sources application again and choose the Authentication tab. Click on the Import Key File… button and load in the public key. After that, Ubuntu will not prompt you for confirmation every time you try to install a CRAN package.

To install packages system-wide run (from the bash prompt):

sudo R

then type

install.packages(‘pkgname’, dep = TRUE)


2010/05/01

H index

Filed under: Misc — S @ 23:29

H index is a scientific productivity and impact index for scientists.

A scientist has index h if h of [his/her] Np papers have at least h citations each…

http://en.wikipedia.org/wiki/Hirsch_number

for Google Scholar

http://code.google.com/p/citations-gadget/

For Web of Science, search for your name (make sure that is for only web of science and not all databases as is the default for ISI). Then click on citation report on the right-hand side of the screen.

Blog at WordPress.com.