Saturday, December 31, 2005

Pot-Dealing Kids Use MMS for Higher Sales

A group of six Massachusetts 15-year-olds used MMS to announce their pot stash was in to other kids in the area. The mom of an intended customer got a hold of a picture advertising a sale and called the cops.

Tuesday, December 20, 2005

Go Take A Hike

New York transit workers are on strike for the first time in 25 years. The subway and bus system which carries 7 million people daily are closed. Workers are battling over wage hikes, health-care and pension costs and retirement age. The strike violates state law prohibiting strikes by public employees.

Sunday, December 18, 2005

GAMES Google Map (Class of 2002)

Between 2000-2002, I attended the Georgia Academy of Mathematics Engineering and Science (GAMES) at Middle Georgia College in Cochran, GA. The Google Map below shows where other people in the program have since moved.

Casey wants me to show people the other version of the map I created. So temporarily, I have a better one on my webserver. It was my first attempt so it has a lot less people on it.

IE <pre> overflow Attribute Error

Internet Explorer fails to properly render the <pre> tag overflow: auto correctly. A simple hack from this forum post:
/* IE Fixes */
* html body pre {
    width: 95%;
    height: 100%;
    overflow: auto;
}

Friday, December 16, 2005

Creating a R Package in Win XP with Cygwin

The short answer you can't build packages using Cygwin tools and a Windows installation of R. Building a package with R requires certain Unix tools and trying to set the Windows Path environment variable to include cygwin\bin does not work because the programs are not compiled in a way R can use them.
Necessary Tools

The tools you'll need to create the package (these are all required)

  1. The Unix utilities, Rtools, by Brian Ripley and Duncan Murdoch. A batch file later in this article requires the zip file to be placed in C:\Program Files\R\R_VERSION\Rtools
  2. If the package contains C/C++/Fortran code you will need the MinGW GNU compiler set.
  3. ActiveState Perl
  4. The Microsoft html help compiler
  5. A version of TeX (MikTex)
Creating Package Structure
A basic R package requires two files in the top level directory. Throughout this article packagename refers both to the name of the package and the name of the top level folder when used with Rcmd.exe.

DESCRIPTION
NAMESPACE
And two subdirectories
man:     Documentation
R:    R functions
The DESCRIPTION file has the following format:
Package: pkgname
Version: PROGRAMVERSION
Date: DATE
Title: TITLE
Author: Joe Developer , with contributions from A. User .
Maintainer: Joe Developer 
Depends: R (>= R_VERSION)
Description: A short (one paragraph) description of what the package does and why it may be useful.
License: GPL version 2 or newer
URL: http://www.r-project.org, http://www.another.url
The NAMESPACE file contains a list of functions in your package which will be available to the user:
export( function1, function2, ... )
The man folder contains documentation for R objects written in "R documentation" (Rd) format that is similar to LaTeX. The man\packagename.Rd file has the following format:
\name{packagename}
\alias{packagename}
\title{Title}
\description{...}
\usage{function(arg1, arg2, ...)}
\arguments{
\item{arg_i}{arg_i description}
}
\examples{...}
\seealso{...}
\keyword{key}
The R folder contains R code to be included in the package:
function_name=
function(arg) {...}
Setting Up Tools

The following batch script masks a Cygwin installation from R by setting the PATH environment variable to only the directories necessary to build or install an R package. All R CMD commands should be run in the command prompt the following batch file creates.

NOTE: This scripts works even if Cygwin is installed. HOWEVER, you can not have any Cygwin applications running (not even a shell or XEmacs for Cygwin) at the same time you try to run RCMD.
@echo off
rem ###################################################
rem # Usage: RCMDprompt.bat [path]
rem #
rem # This script opens a MS-DOS prompt with a enviroment variables
rem # set such that R can be ran and packages can be build.
rem # If 'path' is given, the working directory will be set accordingly.
rem #
rem # NOTE: This scripts works even if Cygwin is installed.
rem # HOWEVER, you can not have any Cygwin applications
rem # 
running (not even a shell or XEmacs for Cygwin) at the same
rem #
time you try to run RCMD.
rem #
rem # Requires:
rem # To build and install packages two things must be installed, i.e.
rem # exists in the PATH. First, the Rtools compilation [1] by B.
rem # Ripley must exists. The path (R_TOOLS) to it is set below.
rem #
Second, Perl (must not be Cygwin/Perl) must also exists. The
rem #
path to it is set below.
rem #
rem # Reference:
rem # [1] http://www.stats.ox.ac.uk/pub/Rtools/
rem #
rem # Henrik Bengtsson, hb at maths.lth.se, Mar-04
rem # Modified by Augustin Luna, augustin at mail.nih.gov, Dec-05
rem ###################################################

rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rem # 1. "Global" environment variables
rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rem # Short version of PROGRAMFILES, e.g. 'C:\Progra~1' instead of
rem # 'C:\Program Files\', which contains spaces that are BAD for R
set PROGRAMFILES_SHORT=C:\Progra~1

rem # Directory where user directories are
set USERSDIR=C:\Docume~1

rem # Set the main R directory
set R_ROOT=%PROGRAMFILES_SHORT%\R

rem # Set the R_HOME directory (THIS LOCATION MAY BE DIFFERENT)
set R_HOME=%R_ROOT%\rw2011
rem set R_HOME=%R_ROOT%\rw2011

rem # Set the HOME directory. This is the directory where R looks
rem # for the .Rprofile and .Renviron files. See ?Startup.
set HOME=%USERSDIR%\%USERNAME%
rem # Set TMPDIR to a temporary directory
set TMPDIR=%TEMP%

rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rem # 2. Setup the PATH
rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rem # Clear the PATH (making the main Cygwin installation
rem # "invisible")
path ;

rem # Set the LaTeX directory (Using default installation parameters)
path C:\texmf\miktex\bin;%PATH%

rem # Set the Microsoft HTML Help Compiler directory
path %PROGRAMFILES%\HTML Help Workshop;%PATH%

rem # Set the Perl directory
path C:\Perl\bin;%PATH%

rem # Set the Rtools\bin directory
rem # (THIS LOCATION MAY BE DIFFERENT)
path %R_HOME%\Rtools\bin;%PATH%

rem # Set the R_HOME directory
path %R_HOME%\bin;%PATH%

rem # Set the WINDOWS directory
path %SystemRoot%;%PATH%

rem # Set the WINDOWS/system32 directory
path %SystemRoot%\system32;%PATH%

rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rem # 3. Start the MSDOS prompt in the given directory
rem # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
rem # Change directory according to argument 1
cd %1%

rem # Start the MSDOS commando prompt
%SystemRoot%\system32\cmd.exe
Modifications from the original RCMDprompt.bat script
Checking Package Documentation

The CHECK parmeter is used to check the documentation of the package for any errors.

Rcmd.exe CHECK packagename
You may see the following error:
* checking packagename-manual.tex ... ERROR
LaTeX errors when creating DVI version.
This typically indicates Rd problems.
Typically, but not always and not in this case. You now need to do the following

  1. Run the MiKTeX options program, choose the TeX formats page, and then for the following programs to use the old engine (latex and pdflatex) do the following:
  2. Click on the Edit button,
  3. Choose "pdfTeX" as the compiler,
  4. Click Apply,
  5. Click Build
After doing this re-run Rcmd.exe CHECK packagename. Most likely you will get a popup titled "Package Installation" attempting to install the following packages:
upquote and lm
Click Change; Select Internet; Choose a Package Repository and click Finish. Click Install. The popup will reappear if you there are any other necessary packages that need to be installed.

Building Package
Rcmd.exe BUILD packagename
Installing Package
Rcmd.exe INSTALL packagename_version.tar.gz
References
Making R Packages Under Windows by Peter Rossi (PDF)
http://cran.r-project.org/doc/manuals/R-exts.html
http://www.murdoch-sutherland.com/Rtools/
https://stat.ethz.ch/pipermail/r-devel/2004-March/029152.html

Thursday, December 15, 2005

All the King's Horses and All the King's Men

It turns out that NOLA levees were inspected very little. Instead, levee commissioners would "normally meet and get some beignets and coffee in the morning" and then "go do the tourist and you have a nice lunch somewhere or whatever." In a partial deposition by a senate panel on Thursday, former Orleans Levee Board president, James P Huey told investigators "When you say inspections - and I don't really know and I couldn't even answer to tell you - how do you inspect levees other than if you see seepage?"

In October, Huey resigned over questions about no-bid contracts given to members of his wife's family. Huey is no stranger to scandal. In 1997, Huey authorized the hiring of private detectives to discredit Robert Namer, a right-wing radio talk show host, in order to discredit him and stop his on-air tirades against the Levee Board.

This comes days after officials the US Army Corps of Engineers expressed relief that the flood wall construction did match the design, which was built in the early 1990s. Their reward for a job well done? A new $13 million museum using funds for Katrina relief. The man responsible for the museum is Thad Cochran, a Republican senator from Mississippi and the chairman of the Senate Appropriations Committee.

Faked Stem Cells

Hwang Woo Suk, the researcher who cloned the first human embryo and dog, faked a June research paper in Science reporting his team had cloned 11 patient-specific stem-cell lines with DNA matching the patients. This is after the controversy of coercing his female researchers to donate their eggs.

Tuesday, December 13, 2005

French protester Bové freed for WTO meeting

José Bové, an antiglobalization protester who demolished a McDonald’s in France in 1999, was detained by immigration officials in Hong Kong. WTO's director general, a Frenchman, and the French Consulate intervened and Bové was released. Bove has a criminal record, he has been barred from visiting summits in the United States and Canada in the past.

Daniel Robert Morena (March 11, 1982-December 9, 2005)

Last Friday afternoon, Daniel Robert Morena, a young male patient, in the Clinical Center of the NIH climbed a eight-foot barrier on the seventh floor and fell into the atrium. He was pronouced dead shortly after arriving at nearby Suburban Hospital. Daniel was a mental health patient suffering from schizophrenia, and he was the first suicide since the NIH started treated mental health about 50 years ago. Today, a memorial service was held in the Lipsett Amphitheater to reflect on the tragic event and to stress importance of our work as scientists and clinicians. It is also important to reflect the seriousness of mental health as a disease.

Daniel had studied about world religions and shown interest in Buddhism. On the memorial service program was a writing by Venerable Geshe Kelsang Gyatso, a Buddhist monk:
Remembrance

Buddha taught that all life is impermanent and that those who are born must eventually pass from this life. However, everyone has within them the seeds or their past virtues, which has the power to bring a fortunate rebirth in the future.

We pray that through the power of this virtue, through the blessings of the holy beings, and through the force of our heartfelt prayers, our dear freiend, Daniel Morena, will experience great good fortune and everlasting peace and happiness.

We also pray for the bereaved relatives and friends, that they may be comforted in their loss and find peace of mind and strength of heart.

May all beings without exception be released from suffering, and find true happiness and everlasting peace.

ANCOVA

ANCOVA, or analysis of covariance is a test in statistics that is often implemented in computing packages. ANCOVA is a merger of ANOVA
and regression for continuous variables. ANCOVA tests whether certain factors have an effect after controlling for quantitative predictors. The inclusion of covariates increases statistical power because it accounts for the variablity.
Equations
One-factor ANCOVA analysis
One factor analysis is appropriate when dealing with more than 3 populations; k populations. The single factor has k levels equal to the k populations. n samples from each population are chosen random from their respective population.

Calculating the Sum of Squared Deviates for the Independent Variable X and the Dependent Variable Y
The sum of squared deviates (SS): SSTy, SSTry, and SSEy must be calculated using the following equations for the dependent variable, Y. The SS for the covariate must also be calculated, the two necessary values are SSTx and and SSEx.

The total sum of squares determines the variablility of all the samples. nT represents the total number of samples:
SST_y=\sum_{i=1}^n\sum_{j=1}^kY_{ij}^2-\frac{(\sum_{i=1}^n\sum_{j=1}^kY_{ij})^2}{n_T}
The sum of squares for treatments determines the variablity between populations or factors. nk represents the number of factors:
SSTr_y=\sum_{i=1}^n(\sum_{j=1}^kY_{ij}-\frac{\sum_{j=1}^k(Y_{ij})^2}{n_k})
The sum of squares for error determines the variability within each population or factor. nn represents the number of samples with a given population:
SSE_y=\sum_{j=1}^k(\sum_{i=1}^nY_{ij}^2-\frac{\sum_{i=1}^k(Y_{ij})^2}{n_n})
The total sum of squares is equal to the sum of the sum of squares for treatments and the sum of squares for error:

SSTy = SSTry + SSEy

Calculating the Covariance of X and Y

The total sum of square covariates determines the covariance of X and Y within the all the data samples:
SCT=\sum_{i=1}^n\sum_{j=1}^kX_{ij}^2Y_{ij}^2-\frac{(\sum_{i=1}^n\sum_{j=1}^kX_{ij})^2Y_{ij}^2}{n_T}
SCE=\sum_{j=1}^k(\sum_{i=1}^nX_{ij}^2Y_{ij}^2-\frac{\sum_{i=1}^k(X_{ij}Y_{ij})^2}{n_n})
Adjusting the SSTy

r_T^2 is the correlation between X and Y
r_T^2=\frac{SCT^2}{SST_xSST_y}
r_n^2=\frac{SCE^2}{SSE_xSSE_y}
The proportion of covariance is substracted from the dependent, SSy values:
SST_{yadj}=SST_y-r_T^2
SSE_{yadj}=SSE_y-r_n^2
SSTryadj = SSTy[adj] − SSEy[adj]

Adjusting the means of each population k

The mean of each popluation is adjusted in the following manner:
M_{y_iadj}=M_{y_i}-\frac{SCE_y}{SCE_x}(M_{x_i}-M_{x_T})

Analysis Using Adjusted Sum of Squares Values

Mean squares for treatments where dfTr is equal to NTk − 1. dfTr is one less than in ANOVA to account for the convariance and dfE = k − 1:
MSTr=\frac{SSTr}{df_{Tr}}
MSE=\frac{SSE}{df_E}
The F statistic
F_{df_E,df_{Tr}}=\frac{MSTr}{MSE}

Sunday, December 11, 2005

Racial Violence in Sydney

Thousands of suburban white youths in Sydney chanted racial slurs and some attacked people of Middle Eastern origin. These attacks were in response to reports of Lebanese youths attacking two of Cronulla beach's life guards. Twelve people were arrested for assaults and one man was stabbed.

Explosions At UK Fuel Depot

Britain's fifth largest fuel depot in Hertfordshire has been hit by massive explosions sending smoke up to 40 miles away. Forty-three people have been injured; two are seriously hurt. Two-thousand people have been evacuated from nearby homes.

Saturday, December 10, 2005

LA Riots, Pt. 2


Stanley "Tookie" Williams has been on death row since 1979 for the murder of 4 people. He along with Raymond Lee Washington are known as the founders of the Crips gang. During his time in San Quentin, he has become a anti-gang activist. Williams has written an autobiographical book entitled Life In Prison aimed at 8-12-year-olds to discourage kids from joining gangs. In the book, he writes about the reality of prison from the humiliation of strip searches to being locked up in solitary confinement. In 2001, received a nomination for the Nobel Peace Prize.
Williams is set to be executed on Dec. 14. So far, Schwarzenegger has been quiet about Williams's fate. LA council members expect violence if he is executed, and LA police, school, and local groups have been told to prepare. Robin Toma, executive director of the LA County Human Relations Commission has stated there is information about planned and intentional acts of violence if Williams is executed. The Department of Corrections and Rehabilitation has also stated that several threats are being investigated and all of San Quentin's inmates, as well as other prisons, will be locked down during the execution.

Friday, December 09, 2005

Merck's Deleted Vioxx Data

The editors of the New England Journal of Medicine allege that authors of a Merck-funded study of Vioxx in 2000 deleted relevant data before submitting the article for publication including that three additional patients in the clincal study suffered heart attacks. A table entitled "CV events" was deleted two days before submittal. On the financial side, the price of Merck stock dropped 3% today.

Yahoo! Acquires del.icio.us

Today, Yahoo! acquired del.icio.us, the social bookmarking service. Here are the respective blog entries: Yahoo! Searchblog and the del.icio.us blog. Stuart Maxwell, Jeff Barr, and Yahoo! team's Jeremy Zawodny recently did an interview explaining "What's so cool about del.icio.us", in which Jeremy gave a non-committal answer about Yahoo acquiring del.ico.us

Jet Skids Off Runway Killing Boy

In Chicago, a Southwest Airlines jet skidded off the runway Thursday evening while trying to land. It went into a street and killed a 6-year-old boy in a car. Ten other people were injured most of them on the ground.

Thursday, December 08, 2005

In Situ Hybridization

ISH (In situ hybridization) uses a complementary strand of DNA to localize a specific DNA sequence in a tissue or onto a specific location on a chromosome. ISH is possible because of DNA's ability to hybridize, or anneal, to its complementary strand at the correct temperature. The DNA probe is fluorescently label (Fluorescent in situ hybridization or FISH) or it may be detected through autoradiography if the probe is radioactively labelled.

Process
Sample cells are treated to increase their permeability and allow the hybribization of the probe. A complmentary probe is created with a radioactive or fluorescent label. The probe is added to the treated cells and allowed to hybridize; excess probe is washed away. Autoradiography, immunochemistry, or fluorescence microscopy is used to detect the probe's location.

Applications
ISH can be used to determine the structure, function, and evolution of chromosomes. It is used in chromosomal gene mapping or to determine the expression of genes.

Wednesday, December 07, 2005

Death by SMS

In a new twist to careless drivers on cellphones, a 17-year-old hit a bicyclist while text messaging. The bicyclist, Jim Price, died two days after the accident. The teen could face up to one year in prison for careless driving resulting in death.

Friday, December 02, 2005

Creating Tables in Blogger

Tables in Blogger need to be put entirely on one line:

<table><tr><td>a</td></tr><tr><td>b</td></tr></table>

Otherwise, Blogger inserts a <br> for each line in your table above the table.

McNemar's Test

McNemar's test is is a non-parametric method used on nominal data to determine whether the row and column marginal frequencies are equal. It is named after McNemar, Q., who introduced it in 1947. Given 2 x 2 contingency table with a dichotomic trait with matched pairs of subjects.
In the following example, a researcher attempts to determine if a disease is associated with the presence of a particular gene. Individuals without the disease are controls and individuals with the disease are cases. Within the cases and controls, individuals with the hypothesized disease gene are marked as positive for the presence of the gene and individuals without the gene are marked as negative.

Controls
+-total
Cases+10159160
-12133154
totals22292314

The cells can be represented in the following manner by the letters a, b, c and d, The totals across rows and columns marginal totals, and the grand total is represented by n:

Controls
+-total
Cases+''a''''b''''a''+''b''
-''c''''d''''c''+''d''
totals''a''+''c''''b''+''d''''n''


Marginal homogeneity occurs when the row totals are equal to the column totals, a and d in each equation can be cancelled; leaving b equal to c:

(a + b) = (a + c)
(c + d) = (b + d)


The McNemar statistic is shown below:

χ2 = (bc)2 / (b + c)

χ2 is a chi-squared statistic with the df = 1. The formula may be re-written to correct for discontinuity:

χ2 = ( | bc | − 1)2 / (b + c)

The marginal frequencies are not homogenous, if the the χ2 result is significant p < 0.05. If b and/or c are small, (b + c) < 10, χ2 is not approximated by the chi-square distribution instead a Fisher's exact test should be used.

Thursday, December 01, 2005

Move Along, Nothing To See

NBC failed to tell viewers that two sisters, aged 11 and 26, had been injured by the M&M's float in the Macy's Thanksgiving Day Parade. Instead NBC showed footage of the float from last year, and the hosts stuck with their given scripts. Macy's offered the sisters VIP tickets to next year's parade.