CODE Flashcards

(78 cards)

1
Q

Number of successes (binomial)

A

x

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Number of trials (binomial)

A

size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Probability of success in each trial (binomial)

A

prob

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Number of repeats (binomial)

A

n

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Probability of overall outcome (binomial)

A

p

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Probability density at each point (binomial distribution)

A

dbinom(x, size, prob)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Is explained by

A

~

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Add line of best fit

A

abline()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Change data class

A

as.class(DATASET)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Boxplot

A

boxplot()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Print data classes

A

class()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Create a new data frame

A

data.frame()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Print the data in a single column

A

DATASET$COLUMN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Changing dataset class

A

DATACLASS(DATASET$COLUMN)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does the function describeBy() output?

A

Variation
Variable
Mean
SD
Median
Trimmed
Mad
Max
Min
Range
Skew
Kurtosis
SE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Display working directory

A

getwd()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Install a package into working environment

A

install.packages()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Load the package into the workspace

A

library(PACKAGE)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Load the working env

A

load(“FILENAME.Rdata”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Give the regression line

A

lm()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Print objects loaded into the working environment

A

ls()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Probability of up to a certain value (binomial)

A

pbinom(x, size, prob)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Plot a explained by b

A

plot(a~b)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Probability of up to a certain value (normal distribution)

A

pnorm(x, mean, sd)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Dataset preditcions
predict(object, newdata interval="confidence")
26
Set working directory
setwd()
27
Summarise a dataset
summary(DATASET)
28
Compare two groups (i.e.: treatment and control)
Two sample t test t.test(a~b, data=dataframe)
29
Compare one group to a mean (determine if they belong to the same population)
One sample t test t.test(output, mu=population_mean, data=dataframe)
30
Calculate the critical value (highest possible) of a given distribution at a specific alpha (opposite of pbinom)
qbinom (1-alpha, size, prob)
31
Two-tailed hypothesis test
binom.test(number of successes, size, prob)
32
How is a t-test made paired?
paired=T is added
33
Why would a t test be paired?
Samples are in pairs (i.e.: before and after)
34
What two functions give Q-Q plots to test normal distribution?
qqnorm() and qqline()
35
Undergo an ANOVA test
aov(data~group, data=data_frame)
36
Adjust p values as boferroni or BH
p.adjust(p, method = "BH") p.adjust(p, method = "bonferroni")
37
Apply a particular function to every row/column of data
apply()
38
How do you specify specific columns (e.g.: 1-5)
[1:5]
39
To run an ANOVA what must occur first if all columns are continuous data?
Vectors must be stacked such that the categorical variables are in one column (ind) and the continuous data is in the other (values).
40
Stack vectors
stack()
41
Turkey Honesty Significance Test
TukeyHSD(fit) (where fit= aov(data~group))
42
How do you make a t test be one-tailed?
Add: alternative = greater/less
43
How can you make a t test be paired?
Add: paired = True/T
44
How can you check for variance?
describeBy()
45
Correlation coefficient
cor()
46
Regression equation (linear)
lm()
47
Predict values of variable a from variable b, where b=15 and a is explained by b
predict(object, newdata, interval = "confidence") where: object = lm(a~b) output newdata = the dataframe with new data in it, ouput of: data.frame(b=c(15)) interval = "confidence" = the type of intervals we want to calculate
48
How should you output an ANOVA?
Assign it to an object and use the summary() function on said object
49
Printing a single value from a vector (produce value 3 from vector d)
d[3]
50
Produce a single value from a dataset by it's row and column
dataframe_name[row_number,column_number]
51
Produce a single row from a dataset by it's number
dataframe_name[row_number, ]
52
Produce a single column from a dataset by it's number
dataframe_name[ ,column_number]
53
Print column names of a dataframe
names()
54
Print column names and top few rows of a dataframe
head()
55
Print row names of a dataframe
rownames()
56
Print the first two rows of a dataframe
head (data_frame, n=2)
57
What data is given by a summary() function?
Min. 1st Qu. Median Mean 3rd Qu. Max.
58
Convert a numeric variable into a factor variable
factor(data_frame$variable) Remember to then store this under the column/ object name to ensure the change is registered
59
Produce summary statistics by group
describeBy(a, group=b) where is a is the object to be summarised by b
60
Calculate the probability of observing an exact number of "successes" (binomial distribution)
dbinom(x, size, prob)
61
Calculate the probability of observing up to a certain number of “successes” or events (binomial distribution)
pbinom(x, size, prob)
62
Calculate the probability of observing up to a certain number of “successes” or events (normal distribution)
pnorm(x, mean, sd)
63
Define scalar
Scalar <- object storing a single value``
64
Define strings
Strings <- objects storing words
65
Define vectors
Vectors <- object holding more than one value
66
Define dataframe
Dataframe <- objects with hold several sets of values
67
How do you make a binom.test one tailed?
Add: alternative = greater/less
68
How might you make a non-numeric varaible be treated as a numeric one so as to plot it?
plot(a~as.numeric(b), data=data_frame) where b is a non-numeric dataset
69
What function might make plots coloured?
col=
70
What function can change the shape of plots on a scatter diagram?
pch=
71
What must be true about the arrangement of data for a paires t test to work?
Must be by the same order in both groups
72
What test can be done to check if a dataset looks normally distributed?
Q-Q plot qqnorm() qqline()
73
What does the table produced by R in an ANOVA represent?
The first column represents the source of variation, both between groups (1st row – treatment) and within groups (second row – Residuals).
74
In the R output, which value of a summary(ANOVA) refers to SSW?
Sum sq Reiduals
75
In the R output, which value of a summary(ANOVA) refers to SSB
Sum Sq TOP ROW
76
Which function is used to stack data?
stack()
77
What function gives the scatterplots for pairs of columns?
pairs(data_frame)
78
Residuals plot
plot(fit$residuals~fit$fitted.values, data=cars) where fit<-lm(a~b, data=data_frame)