Professional Documents
Culture Documents
R") COMMAND EXAMPLE DESCRIPTION Basic arithmetic == can be read as is equal to not equal to Opens help for a command Combines 1, 4, 5 into one object Loads in a dataset from the textbook Get information about the dataset Extracts a variable from a dataset New data only cases where var < 5 Draw a random sample of 5 from x Reads in data from a google doc1
Click on dataset name in workspace window to view dataset Summary Statistics table table(x) table(x,y) mean mean(y) mean(y~x) median median(y) median(y~x) sd sd(y) percentile summary cor diffMean percentile(y, .05) summary(y) cor(x,y) diffMean(y~x) Make a table for one or two categorical variables Calculate the mean Calculate the median Calculate the standard deviation Calculate a percentile of x Five number summary of x Calculate the correlation Calculate difference in means
The key is everything between key= and # in the link for the google spreadsheet. For this to work on your own google docs, you have to first click File > Publish to Web > Start Publishing.
1
diffProp
diffProp(gender==male~x)
Calculate difference in proportions Create a bar chart, segmented bar chart, or side-by-side bar chart Create a pie chart Create a histogram Create a boxplot Create a scatterplot Adds a title to a graphic Labels the x and y-axes Repeats what is after the * 100 times Draw a random sample of 5 from x with replacement Randomly reorders x Calculate a percentile of y or specified distribution Find the proportion as extreme as stat in dist or specified distribution
Visualization barplot
barplot(x) barplot(x~y) barplot(x~y, beside=TRUE) pie(table(x)) hist(y) boxplot(y) boxplot(y~x) plot(x,y) hist(y, main=Title) plot(x,y, xlab=x-axis)
shuffle shuffle(x) percentile percentile(y, .05) percentile(normal, .01) percentile(t, .975, df=20) tail.p tail.p(dist, stat, tail=upper)
tail.p(normal, stat, tail=lower) tail.p(t, stat, tail=two, df=20) tail.p(chisquare, stat, df=2, tail=upper) tail.p(f, stat, df1=3,df2=100, tail=upper)
t.test
aov
chisq.test chisq.test(x1,x2)
chisq.test(x1,x2,simulate.p.value=TRUE)
Create a bootstrap CI Conduct a randomization test Conduct a test and interval for difference in proportions Conduct a test and interval for difference in means ANOVA for difference in means Chi-square test for association
Regression lm
summary
Fits a model regressing y on explanatory variables x1, x2, Gives model output (model is an object created with lm) Extracts residuals from a model Gives predicted values, with intervals Predicted values for new cases Adds a regression line to a scatterplot