Monday, December 21, 2015

ggplot2 2.0.0

ggplot2 2.0.0


I have used the ggplot2 package for a while and really like this package. It's happy to see that Hadley Wickham has officially updated the ggplot2 to version 2.0.0. On the RStudio Blog, Hadley highlights several important changes:
  • ggplot2 now has an official extension mechanism.
  • There are a handful of new geoms, and updates to existing geoms.
  • The default appearance has been thoroughly tweaked so most plots should look better.
  • Facets have a much richer set of labelling options.
  • The documentation has been overhauled to be more helpful, and require less integration across multiple pages.
  • A number of older and less used features have been deprecated.


You can find the document/manua on the project website. Many times, I go to the dev website to find the latest document/vignettes (extension, aesthetic specifications, themes).

The R Graphics Cookbook by Winston Chang is a must-have book to learn and become an expert of ggplot2 user. You can find the codes here from the Cookbook-R, and the Google book here.

Tuesday, December 15, 2015

general linear models vs. generalized linear models

General linear models vs. generalized linear models


 



Typical estimation method



Special cases



Function in R



Function in Matlab

mvregress()

glmfit()

Procedure in SAS



Command in Stata



Function in Mathematica

LinearModelFit

GeneralizedLinearModelFit

Command in EViews

ls
  • Generalized linear models have the flexiblility for response variables that have other than a normal distribution. If a generalized linear model uses an identity link function and a normal family distribution, then this model is equivalent to a general linear model.
  • Generalized linear mixed models have the flexibility to model random effects and correlated errors for nonmormal data.

non-probability sample

Non-Probability Sample


Definition
Reflection
Video

Friday, November 20, 2015

All-cause mortality was increasing among US middle age whites

All-cause mortality was increasing among US middle age Whites


Title: Rising morbidity and mortality in midlife among white non-Hispanic Americans in the 21st century
Authors: Anne Case and Angus Deaton
Abstract: This paper documents a marked increase in the all-cause mortality of middle-aged white non-Hispanic men and women in the United States between 1999 and 2013. This change reversed decades of progress in mortality and was unique to the United States; no other rich country saw a similar turnaround. The midlife mortality reversal was confined to white non-Hispanics; black non-Hispanics and Hispanics at midlife, and those aged 65 and above in every racial and ethnic group, continued to see mortality rates fall. This increase for whites was largely accounted for by increasing death rates from drug and alcohol poisonings, suicide, and chronic liver diseases and cirrhosis. Although all education groups saw increases in mortality from suicide and poisonings, and an overall increase in external cause mortality, thosewith less education saw the most marked increases. Rising midlife mortality rates of white non-Hispanics were paralleled by increases in midlife morbidity. Self-reported declines in health, mental health, and ability to conduct activities of daily living, and increases in chronic pain and inability to work, as well as clinically measured deteriorations in liver function, all point to growing distress in this population. We comment on potential economic causes and consequences of this deterioration. Full text: PNAS

Related articles:




Saturday, October 10, 2015

How to recover a lost partition of a hard drive

How to recover a lost partition of a hard drive


There are two major reasons you might not see the drive letter of your computer: the logic drive letter lose  or partition table corrupted.

Try these steps first:
  • Go to the 'cmd' window by holding the "Windows" key and press the "R" key
  • Type and run 'diskmgmt.msc'
  • "Disk Management" will be shown.
  • If see a partition without a drive letter then right-click on it
  • Select "Change Drive Letter and Paths..." 
  • Click on "Add" button
  • Select the drive letter and Click on OK.
If you cannot see the partition without a drive letter, the partition table may be corrupt, try the TestDisk after the original instruction here or abstracted steps below:
  • Download the TestDisk
  • Unzip and save it on the USB drive
  • Run "testdisk_win"
  • At the first window, select “No Log” and press the key
  • Select which drive to analyse, choose “Proceed” and press key
  • Select partition type (select "Intel" if it’s a PC) then press key
  • Select “Analyse” then press key
  • Select “Quick Search” at the next screen, then press  key
  • Press key, if the partitions were created under Vista – press key if not.
  • TestDisk should say “Structure OK”. If so, press key 
  • Select “Write” and press key and press   key to confirm.
  • "ok" to reboot the compute, press key
  • Now, close TestDisk and RESTART the computer.

Sunday, June 28, 2015

R documentation and Learning Resources

R! documentation and Learning Resources

Monday, June 01, 2015

Running and longevity

Running and Longevity

News
  • DialyMail: Stop that binge jogging
    • Long term study found slow joggers had the lowest rates of death
    • Strenuous joggers were as likely to die as sedentary non-joggers
    • Going jogging three times a week for no more than 2.4 hours is optimal
    • Pace of the slow joggers corresponds to vigorous exercise and strenuous jogging corresponds to very vigorous exercise, researchers qualified
  • ScienceDaily: Light jogging may be most optimal for longevity
Guidelines and Researches

Sunday, February 08, 2015

The Roseto Mystery

The Roseto Mystery

A few days ago, I read a book, Outliers (2008), by Malcolm Gladwell. The book is quite insightful. All children, parents, grandparents (ha-ha), and educators can be benefited from reading it. The introduction chapter is about the Rosetans who living in the Pennsylvannia, which is more related to my work. The Rosetans are outliers who are eating a big portion of saturated fat including lard with some other bad habits such as smoking. However, “THESE PEOPLE WERE DYING OF OLD AGE. THAT’S IT.” The Gladwell showed some evidences of importance of a low stressful lifestyle, good supports from family, friends, and communities for the health and longevity.

Here are a few more stories related to the Rosetans who living in Roseto, Pennsylvania:

Monday, January 12, 2015

Cancer isn’t just bad luck

Cancer isn’t just bad luck
By Thomas Lumley

"
From Stuff, "Bad luck is responsible for two-thirds of adult cancer while the remaining cases are due to environmental risk factors and inherited genes, researchers from the Johns Hopkins Kimmel Cancer Center found."

...

So, in summary: the “two-thirds of cancers explained” is Just Wrong. Doing a mathematically correct calculation gives about one third. Doing a calculation that’s actually relevant to cancer in the population gives even smaller values. (update) That’s not to say that DNA replication errors are unimportant — the paper makes it clear that they are important.
"

The fulltext: Cancer isn't just bad luck