Logistic Regression and How to interpret it

When to use Simple Logistic Regression Logistic regression is used when Yi, response variable is binary, 0 or 1. Meaning of Response Function of binary response var Yi = beta_0 + beta_1* Xi + ei Considering Yi as bernoulli random variable, P(Yi =1 ) = pi ** let’s say probability of success P(Yi = 0 […]

Read More →

My Fav Pizza dough recipe

Thin Pizza Dough (wolfgang puck style) (source: http://www.grouprecipes.com/46552/italian-thin-crust-pizza-dough.html) Ingredients 1 package active dry yeast 1 teaspoon honey 1 cup warm water (105 to 115 F) 3 cups of all-purpose flour 1 teaspoon salt 1 tablespoon extra-virgin olive oil How to cook it Dissolve the yeast and honey in 1/4 cup warm water. Combine the flour […]

Read More →

Plotting density in R

How to plot density plot(density(DATA)) Rainbow color in R If you want to make a plot have rainbow color range, you can use rainbow function: rcol=rainbow(length(YOURDATA)) plot(DATAX, DATAY, type=”l”) points(DATAX, DATAY, pch=16, col=rcol) Simple Plot How to change the size of text in a plot? Use argument cex.[attribute] , and examples are below: main titles […]

Read More →

Useful R syntax

Reading table of selected file from a broswer read.table(file.choose()) nrow (dat) # number of rows head (dat) # shows names and first few rows of dat paste(“hello”, “world”, sep=”-“) # hello-world source(mylibrary.R) # will import mylibrary content rep(NA, 5) # NA NA NA NA NA rep(1:4, 2) # 1 2 3 4 1 2 3 […]

Read More →

r error: FEXACT error 7

R Error: FEXACT error 7 Testing with small sample size, it is more preferable to use the Fisher’s Exact test than the Chi-square test. fisher.test(counts, simulate.p.value=TRUE) If you have too many rows or columns, you may get an error saying, FEXACT error 7. LDSTP is too small for this problem. Try increasing the size of […]

Read More →

Contingency Table for Categorical data and R

How to create contingency table from categorical data in r. Example: There are three categorical variables x1, x2, x3 measured from wild cats where x1 = gender (male, female) x2 = age (young, kitten, adult) x3 = test result ( positive = 1, negative =0). r table will generate two tables: 2by2 table for each […]

Read More →

Validating assumption of multivariate normal data

Univariate and Multivariate diagnostics Univariate diagnostic (Histogram and QQ plot) Plot a histogram hist(mydata.st, main=”histgram”, xlab=”X values”) Plot QQ plot ## pch =16 (16 is a symbol for a filled circle) qqnorm(mydata.st, main=”QQ plot”, pch=16, col=”navy”) Multivariate dignostics Chi-squre plot We will graph distance vs chsq # function to compute distance between X and X.bar […]

Read More →