Lab 2: Means and Beyond- More Descriptive Statistics, Defining and Making Your Own Functions That Can be Reused, and Using R Packages + Lab 3: Confidence Interval of a Proportion Flashcards

1
Q

Can the letter c be used both as a built-in R function and object?

A

YES

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

What will determine whether the letter c is used a built-in R function or as an object?

A

Its location in the code!

- If it precedes the arrow, it's being defined as an object
- If it comes after the arrow, it's being used as a built-in R function
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

If you define an object and then try to define it again with the same letter, what will happen? How would this effect the mean/median

A
  • That object will be overwritten and will now be replaced/ contain the new data set.
  • The mean/ median will change to be representative of the new data set
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

An object is always determined by what?

A

Its newest definition

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

What are two ways in which an exponent can be inputted into R?

A

Using either the carrot(EX: 10^5) or e method (1e+5) with positive (+) numbers

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

What are two ways in which an exponent can be inputted into r?

A

Using either the carrot(EX: 10^5) or e method (1e+5) with negative (-) numbers

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

If there is no built-in R function for performing certain statistical analyses, what can you do?

A

Either define your own R function or download reproducible codes in some fundamental units made by other people called R packages.

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

What is another good way to think of an R package?

A

Like an extra toolbox that contains a variety of tools to add to built- in tools that come with base R

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

Do people usually upload the packages they developed and share them with all R users?

A

YES

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

What are the two ways in which we can install an R package?

A

Type in the R command or use the pull- down manual

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

What is the function you should use to install an R package?

A

install. packages(“ “)

- With a lowercase i and packages being plural

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

What are the “CRAN mirrors?”

A

Mirror sites with the repositories of the package

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

What will happen if you try to install a package into base R using command lines and what do you have to do?

A

The “CRAN mirrors” window will pop up and you’ll have to scroll down and highlight to select “USA (PA 1)” to install?

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

What will happen if you try to install a package into the code editor R Studio using command lines and what do you have to do?

A

The “CRAN mirrors” window will NOT pop up and you won’t have to do anything else, as the package will automatically be installed after hitting enter/return.

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

How do you install an R package in base R, using the pull- down manual?

A

Follow the selection: “Packages”-> Install Package(s)-> select “raster”

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

How do you install an R package in base R, using the pull- down manual?

A
  • There is a tab named “Packages” in the lower-right quadrant/panel, click it
  • Click “install”
  • In the pop-up window, type “raster” in the space below the sentence that reads “Packages separate multiple with space or comma)”
  • Click “install”
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What function must you use to activate a newly installed R package?

A

library(name of package) with a lowercase l and NO QUOTATION MARKS

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

If you stay in the same R session, do you need to reactive the newly installed R package before using it again?

A

NO

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

If you close and restart a new R session, do you need to reactivate the newly installed R package before attempting to use it again?

A

YES

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

What package are the geometric and harmonic mean function found in?

A

The “psych” package

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

What package is the coefficient of variation function found in?

A

The “raster” package

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

What function would you use to find the geometric mean?

A

geometric.mean( )

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

What function would you use to find the harmonic mean?

A

harmonic.mean( )

24
Q

What function would you use to find the coefficient of variation (CV)?

A

cv( )

25
Q

What is the CV calculated by the function “cv( )” from the package “raster” really? As a result, how should it be reported?

A

It’s the percentage of the actual CV, so it should be reported either with a % or as the decimal version of that percentage

26
Q

What function would you use to determine the MAD of a data set?

A

> mad(object,constant= )

27
Q

When trying to determine the MAD of a data set and you’re using the command line “>mad(object,constant= ), what must you specify your constant as if you data set is SMALL`

A

1

28
Q

What are the two ways in which you can find the interquartile range of a data set in R?

A

Use the information from the 5 number summary or use the built- in R function, “IQR( )”

29
Q

When trying to determine the interquartile range of a data set and the data set is small, what may happen and what do we do to avoid this?

A

When the data set is small, different methods may give us different results, so we must specify what method using the argument “type=”

30
Q

When trying to determine the interquartile range of a data set, if you don’t specify what method to use with the argument “type=”, which one will R chose by default?

A

“type=7”

31
Q

When the confidence interval is 95%, the z score is?

A

1.96

32
Q

What does w stand for?

A

The margin of error

33
Q

How do we find the upper CL?

A

p’+w

34
Q

How do we find the lower CL?

A

p’-w

35
Q

What are the 4 ways in which you could find the CI of a proportion in R?

A

Performing step-by-step calculations in R, the Modified Wald Method, Standard Wald Method, Exact Method

36
Q

Out of the 4 ways to calculate the CI of a proportion in R, which is the most accurate and which is the easiest/hardest to do by hand?

A
  • The Standard Wald Method is easiest to compute by hand
  • The Exact Method is hardest to do by hand
  • The Modified Wald Method is not much harder to do than the Standard Wald Method, but it’s MUCH more accurate
37
Q

Is the CI calculated using the Modified Wald Method and the Standard Wald Method going to be the same?

A

NO, they’ll be slightly different

38
Q

Which built-in R function is used for the Modified Wald Method?

A

add4ci( )

39
Q

Which built- in R function is used for the Standard Wald Method

A

addz2ci( )

40
Q

Which built in R function is used for the Exact Method?

A

exactci( )

41
Q

What is the disadvantage of using the Exact Method?

A

It can’t be easily computed by hand and calculates a CI that is sometimes wider than necessary

42
Q

If we increase the confidence level, what will happen to the CI?

A

It will become wider

43
Q

If we decrease the confidence level, what will happen to the CI?

A

It will become narrower

44
Q

What is the relationship between the confidence level and the CI?

A

It’s a direct relationship: As the confidence level increase, the CI becomes wider and as the confidence level decreases, the CI becomes narrower.

45
Q

When should the Rule of Three be used?

A

When the numerator in s/n AKA the number of successes is 0

46
Q

When should the Rule of Five be used?

A

When the numerator in s/n AKA the number of successes is 1

47
Q

When should the Rule of Seven be used?

A

When the numerator in s/n AKA the number of successes is 2

48
Q

When you apply the Rule of Three, Five, or Seven, what is always the lower confidence limit?

A

0

49
Q

When can the Rule of Three, Five, and Seven be applied?

A

When the success # is v small and the sample size is large.

50
Q

You can only take shortcuts like the Rule of Three, Five, and Seven to estimate the CI when the confidence interval is what?

A

95%

51
Q

What does every aspect of this code mean: >add4ci(x=16,n= 565,conf.level = 0.95) ?

A
  • Function “add4ci” is for the Modified Wald Method
  • x or s is the number of successes (s) -> Would change depending on what method being used!
  • n is the number of experiments (n)
  • Conf.level equals the confidence level and expresses it in proportions
52
Q

The functions for the Modified Wald Method, Standard Wald Method, and Exact Method are found under what packages?

A

“PropCIs” and “devtools”

53
Q

What line of code can be used to set p’ after defining s and n when trying to determine the CI of a proportion ?

A

> pprime

54
Q

What line of code can be used to set w after defining pprime(p’), s, and n when trying to determine the CI of a proportion?

A

> w

55
Q

The result from the Rule of Three is closer to the result of which method?

A

Exact Method