some_text

Monday, November 26, 2012

Correlograms

Using Correlograms visualize the data in correlation matrics. 
>Install.Packages(corrgram)
>library(corrgram)
>corrgram(x, order = , panel=, lower.panel=, upper.panel=, text.panel=, diag.panel=) 


Tuesday, May 1, 2012

R: A Simple Way to Calculate Sample Size for A/B Testing

 

power.prop.test(n = NULL, p1 = NULL, p2 = NULL, sig.level = 0.05,
                power = NULL,
                alternative = c("two.sided", "one.sided"),
                strict = FALSE)


n = A number of sample size
p1 = A conversion rate of group 1
p2 = A conversion rate of group 2
sig.level = The significant level
power = 1-type II error = power of the test
alternative = The hypothesis of the test


For example ...

> power.prop.test(p1 = .50, p2 = .75, power = .90)

     Two-sample comparison of proportions power calculation

              n = 76.70693
             p1 = 0.5
             p2 = 0.75
      sig.level = 0.05
          power = 0.9
    alternative = two.sided

 NOTE: n is number in *each* group

Monday, December 5, 2011

MySQL command Using MAMP PRO

I am writing this to just remind myself and share how to access MySQL with MAMP.  To access MySQL with MAMP PRO or MAMP on a terminal window for MacOS X,
First off, you want to install MAMP or MAM Pro on your computer. Go to download it at http://www.mamp.info/en/index.html
Second, open a terminal window

Third, type in   /Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot;
(Don't forget to type ";" to end a commend.)


And now you can start using MySQL commands.  Good Luck! 

Wednesday, November 23, 2011

Statistics of Turkeys - Production, Measured in Dollars in 2010


Happy Thanksgiving, everyone!
Tomorrow is Thanksgiving, Thursday, November 24, 2011.   I am having Thanksgiving with my friends in San Francisco. What about you guys?
I would like to relate Thanksgiving to Statistics.  So I came up an idea, looking at statistics of Turkeys- Production that measured in dollars.  I got the data set from http://quickstats.nass.usda.gov/#202F2C40-1ADA-33FE-ADA4-689C43CEFEA4, and made a bar chart and did the calculation from MS Excel.  According to the record, the highest value is $736,819,000 from the State of Minnesota, and the lowest value is $53,940,000 from the State of West Virginia.






















Feel free to leave me a comment down below. Thank you!

Monday, November 21, 2011

Print and Cat in R


Print : we use print when we want R to print something.
Cat:  we can use the cat function as an alternative way to ask R to print something.

> pi
[1] 3.141593

> sqrt(2)
[1] 1.414214

> print(pi)
[1] 3.141593

> print(sqrt(2))
[1] 1.414214

> print(matrix(c(1,2,3,4,5,6,7,8),4,4))
     [,1] [,2] [,3] [,4]
[1,]    1    5    1    5
[2,]    2    6    2    6
[3,]    3    7    3    7
[4,]    4    8    4    8

> print(list("a","b","c"))
[[1]]
[1] "a"

[[2]]
[1] "b"

[[3]]
[1] "c"


> print("The zero occurs at"); print(2*pi); print("radians")
[1] "The zero occurs at"
[1] 6.283185
[1] "radians"

> cat("the zero occurs at", 2*pi, "radians.", "\n")   # using (\n) to terminate the line
the zero occurs at 6.283185 radians.

> x<-c(2, 3, 5, 7, 11, 13, 17, 19)
> cat("The prime numbers under 30 are:",x,"...\n")
The prime numbers under 30 are: 2 3 5 7 11 13 17 19 ...



Statistics VS Probability

Statistics is the study of the collection, calculation, description, organization, analysis, classification and interpretation of numerical facts or data.
Probability is the branch of mathematics that studies the possible outcomes of given events together with the outcomes' relative likelihoods and distributions.
Let's say that statistics is dealing with data, but probability is all about chance.