CODE Flashcards

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
Q

Dataset preditcions

A

predict(object, newdata interval=”confidence”)

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

Set working directory

A

setwd()

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

Summarise a dataset

A

summary(DATASET)

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

Compare two groups (i.e.: treatment and control)

A

Two sample t test
t.test(a~b, data=dataframe)

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

Compare one group to a mean (determine if they belong to the same population)

A

One sample t test
t.test(output, mu=population_mean, data=dataframe)

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

Calculate the critical value (highest possible) of a given distribution at a specific alpha
(opposite of pbinom)

A

qbinom (1-alpha, size, prob)

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

Two-tailed hypothesis test

A

binom.test(number of successes, size, prob)

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

How is a t-test made paired?

A

paired=T is added

33
Q

Why would a t test be paired?

A

Samples are in pairs (i.e.: before and after)

34
Q

What two functions give Q-Q plots to test normal distribution?

A

qqnorm() and qqline()

35
Q

Undergo an ANOVA test

A

aov(data~group, data=data_frame)

36
Q

Adjust p values as boferroni or BH

A

p.adjust(p, method = “BH”)
p.adjust(p, method = “bonferroni”)

37
Q

Apply a particular function to every row/column of data

38
Q

How do you specify specific columns (e.g.: 1-5)

39
Q

To run an ANOVA what must occur first if all columns are continuous data?

A

Vectors must be stacked such that the categorical variables are in one column (ind) and the continuous data is in the other (values).

40
Q

Stack vectors

41
Q

Turkey Honesty Significance Test

A

TukeyHSD(fit)
(where fit= aov(data~group))

42
Q

How do you make a t test be one-tailed?

A

Add:
alternative = greater/less

43
Q

How can you make a t test be paired?

A

Add:
paired = True/T

44
Q

How can you check for variance?

A

describeBy()

45
Q

Correlation coefficient

46
Q

Regression equation (linear)

47
Q

Predict values of variable a from variable b, where b=15 and a is explained by b

A

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
Q

How should you output an ANOVA?

A

Assign it to an object and use the summary() function on said object

49
Q

Printing a single value from a vector (produce value 3 from vector d)

50
Q

Produce a single value from a dataset by it’s row and column

A

dataframe_name[row_number,column_number]

51
Q

Produce a single row from a dataset by it’s number

A

dataframe_name[row_number, ]

52
Q

Produce a single column from a dataset by it’s number

A

dataframe_name[ ,column_number]

53
Q

Print column names of a dataframe

54
Q

Print column names and top few rows of a dataframe

55
Q

Print row names of a dataframe

A

rownames()

56
Q

Print the first two rows of a dataframe

A

head (data_frame, n=2)

57
Q

What data is given by a summary() function?

A

Min.
1st Qu.
Median
Mean
3rd Qu.
Max.

58
Q

Convert a numeric variable into a factor variable

A

factor(data_frame$variable)
Remember to then store this under the column/ object name to ensure the change is registered

59
Q

Produce summary statistics by group

A

describeBy(a, group=b)
where is a is the object to be summarised by b

60
Q

Calculate the probability of observing an exact number of “successes” (binomial distribution)

A

dbinom(x, size, prob)

61
Q

Calculate the probability of observing up to a certain number of “successes” or events (binomial distribution)

A

pbinom(x, size, prob)

62
Q

Calculate the probability of observing up to a certain number of “successes” or events (normal distribution)

A

pnorm(x, mean, sd)

63
Q

Define scalar

A

Scalar <- object storing a single value``

64
Q

Define strings

A

Strings <- objects storing words

65
Q

Define vectors

A

Vectors <- object holding more than one value

66
Q

Define dataframe

A

Dataframe <- objects with hold several sets of values

67
Q

How do you make a binom.test one tailed?

A

Add:
alternative = greater/less

68
Q

How might you make a non-numeric varaible be treated as a numeric one so as to plot it?

A

plot(a~as.numeric(b), data=data_frame)
where b is a non-numeric dataset

69
Q

What function might make plots coloured?

70
Q

What function can change the shape of plots on a scatter diagram?

71
Q

What must be true about the arrangement of data for a paires t test to work?

A

Must be by the same order in both groups

72
Q

What test can be done to check if a dataset looks normally distributed?

A

Q-Q plot
qqnorm()
qqline()

73
Q

What does the table produced by R in an ANOVA represent?

A

The first column represents the source of variation, both between groups (1st row – treatment) and within groups (second row – Residuals).

74
Q

In the R output, which value of a summary(ANOVA) refers to SSW?

A

Sum sq
Reiduals

75
Q

In the R output, which value of a summary(ANOVA) refers to SSB

A

Sum Sq
TOP ROW

76
Q

Which function is used to stack data?

77
Q

What function gives the scatterplots for pairs of columns?

A

pairs(data_frame)

78
Q

Residuals plot

A

plot(fit$residuals~fit$fitted.values, data=cars)
where fit<-lm(a~b, data=data_frame)