Poli 281 Midterm Terms

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/110

encourage image

There's no tags or description

Looks like no tags are added yet.

111 Terms

1
New cards

Object: Objects store information in R – whether that be a single number or a full data frame. You must return the object to see its contents.

2
New cards

Command: a directive or order that you give to a computer program to perform a task.

3
New cards
4
New cards

Tutorial 2-

5
New cards

Vectors: Vector is a type of object- a one dimensional data structure that stores values of the same type. Have two classes- length and class. Vectors are very useful because they can end up serving as either a row or a column of a database. Vectors are objects which store multiple elements of data.

6
New cards

Vector length: Determined by how many values or elements they hold

7
New cards

Vector Class: Determined by the kind of values (or elements) they hold- Numeric, Character, Logical (Boolean).

8
New cards

Numeric class vector: Stores real numbers, including whole numbers and decimals.

9
New cards

Character class vector: Stores text or individual characters, data must have “” around individual information when in code.

10
New cards

Logical (Boolean) class vector: Values strictly boolean- TRUE or FALSE (or NA). FALSE stored as 0 and TRUE stored at 1.

11
New cards

C() command: It allows us to combine elements to create a vector. place in the parentheses all of the elements you wish to combine into one vector, and separate each element using a comma.

12
New cards

Square brackets []: Reach into an object and pull out a smaller portion/ index and/or subsets objects. Most basic way to select an element is by what we will call “indexing” a vector.

13
New cards

Conditional Statements: statements that evaluate if a certain condition is met, and returns data based on satisfying this condition.

14
New cards

Boolean Values: data type that represents TRUE or FALSE

15
New cards

Types of Conditions: ==  : is equal to,

!= : is not equal to, >and >= : greater than, greater than or equal to, < and <= : less than, less than or equal to.

16
New cards
17
New cards

Tutorial 3-

18
New cards

Data Frames: When we load datasets into R we store them as objects called data frames. Data frames have two dimensions- rows and columns. Each row and column is a vector

19
New cards

Row: stores information horizontally from left to right

20
New cards

Column: stores information vertically from top to bottom

21
New cards

head() command: Way to look at or examine a data frame that has been saved as an object. Will show the first few rows of data frame.

22
New cards

Data: Information collected and stored in a systematic way. In this class we primarily work with datasets- data on specific topics.

23
New cards

Variable: The information collected about observations is organized into variables, which captures a single characteristic. (Columns)

24
New cards

Unit of Observation: The entities on which we collect the data. How we distinguish between unique rows in our data sets. Ex- cities or countries

25
New cards

Time series data: Same group compared over time

26
New cards

Cross Sectional data: Different groups compared at the same time.

27
New cards

Time series cross-sectional data: Comparing two groups over time.

28
New cards

$: Runs a single variable (column) within a dataframe

29
New cards

Nrow() command: Asks R how many rows (or observations) the data has.

30
New cards

Ncol(): Asks R how many columns (or variables) the data has.

31
New cards

Dim(): Asks R how many rows and columns a data frame has.

32
New cards

Summary(): Returns information about each of the variables. In the case of the character variables, it will tell you what class they are (character vs. numeric, for example) and the length of that variable (how many rows). In the case of numeric variables, it will give you useful information such as the minimum value, the maximum, etc.

33
New cards

** indexing: must follow the order of rows first, columns second

34
New cards

[__, ]: To look at a whole row leave the columns portion blank.

35
New cards

[ ,__]: To look at whole column leave the row portion blank.

36
New cards

Working directory: the default location where R looks for files and saves outputs

37
New cards

Getwd(): Checks the current working directory

38
New cards

Matrix: Type of 2D data. Matrices can only handle data where every element is the same type (e.g., all numbers or all characters). Create a matrix with- matrix(data, nrow, ncol, byrow, dimnames)

39
New cards

Combining Conditions: “&” looks for observations that fufill both conditions, “|” looks for values that fufill at least one condition.

40
New cards
41
New cards

Tutorial 4-

42
New cards

Renaming Data: datasetcolumn[datasetcolumn[datasetcolumn == “SpecificData”] <- “SpecificDataNewName”

43
New cards

NA: Code for missing values, lets R know that information is missing. When first importing a dataset it may use different conventions for coding missing values, typically you have access to documentation that will inform you how they coded or labelled missing values. Never put quotes around NA.

44
New cards

Arguments: An input places inside ().

45
New cards

Na.rm = TRUE/FALSE: If TRUE, the function will remove all NA values. If FALSE the NA values will stay, the default is FALSE.

46
New cards

Three types of data: numeric(numbers), characters(text), Boolean (TRUE/FALSE)

47
New cards

Factors: Data type specifically designed for handling categorical data in R. Useful for categorical data.

48
New cards

Nominal Data: Variables that have categories with no inherent order. Examples- Party Affiliation (e.g, Republican, Democrat, Indepedent) & Gender (Male or Female)

49
New cards

Ordinal Data: Variables that have categories with a natural ranking or order. Example- Beginner, Intermediate, and Advanced. Ex- Regime type (strong, weak democracy)

50
New cards

Numeric Variables: Variables with labeled values that have a universally-holding ranking and the distance between these rankings is known and equal. Ex- weight

51
New cards

Levels: In a factor variables, the list of levels is the set of values that a variable can take.

52
New cards

Descriptive Statistics: summaries of data

53
New cards

Central tendency: The typical or most likely value

54
New cards

Mean: The average

55
New cards

Median: The middle value (when all values are placed in order)

56
New cards

Mode:The most frequently occurring value

57
New cards

Dispersion: how spread out a set of numbers are.

58
New cards

Observable: Can directly perceive it

59
New cards

Objective: The definition doesn’t require personal interpretation

60
New cards

Specific: Clearly defined; anyone can agree whether or not a standard was met

61
New cards

Reliability: Is a measure consistent and repeatable? Does it always produce the same results? Ex- A scale

62
New cards

Test-ReTest Reliability: Multiple applications over time should yield consistent results

63
New cards

Inter-Rater Reliability: Different observers agree on how the measure should be applied in the same cases.

64
New cards

Validity: Does the measure accurately represent the concept it is supposed to measure? Ex- How can we measure prejudice

65
New cards

Face Validity: The measurement appears reasonable at a first glance; it appears to be measuring what it says it does

66
New cards

Content Validity: The measurement contains all critical elements of the measured concept

67
New cards

Convergent Validity: The measure is related to existing measures of the same concept

68
New cards

Predictive Validity: The measure is related to related outcomes

69
New cards

Response Bias: People/actors cannot or will not provide accurate data

70
New cards

Social Desirability Bias: Individuals/actors lie to avoid social costs

71
New cards

Recall Bias: where people misremember, forget, or change details about past experiences when asked in a study

72
New cards

Agreement Bias: Respondents (inadvertently) choose positively worded options

73
New cards

Central Tendency Bias: Individuals/actors avoid responding in extreme ways

74
New cards

Random Response Bias:Respondents dont know the answer but guess/speculate anyways

75
New cards

Item non-response bias: Individuals skip specific questions/measures frequently (from confsuion)

76
New cards
77
New cards

Tutorial 5- dplyr commands

78
New cards

Select(): Identifies columns to keep or drop(variables)

79
New cards

Filter(): Identifies rows to keep or drop. filters subsets (rows), allows us to subset/ select a smaller portion of data.

80
New cards

Arrange(): Reorders rows based on their value in some columns

81
New cards

Mutate(): Adds or changes columns

82
New cards

Rename: renames columns

83
New cards

Group_by(): groups the data.  if you group_by() and then use %>%, any operations on the next line of code will be performed separately for whatever variable you group_by

84
New cards

Summarize(): summarises (or aggregates) data

85
New cards

%>% (Pipe Operator): Links multiple dplyr commands in a row. Ensures you do not have to specify your data frame every time.

86
New cards
87
New cards

Tutorial 6-

88
New cards

Discrete Variables: Can only take on specific values (and usually not many). Nominal and ordinal measures. Always logical, character, and factor classes in R. Boolean variables are always discrete.

89
New cards

Continuous Variables: Can take on many values (and usually partial values), always numeric class Ex- income range 0-250,000 or range of ages 18-95

90
New cards

X-axis: Shows possible values for the variable we want to summarize

91
New cards

Y-axis: Shows how common each value is in the dataset

92
New cards

Histogram: Puts a single continuous variable in “bins" and then shows how common each bin is (letting us look at the distribution) plot information for a single variable. Typically used for continuous variables.

93
New cards

Bar Graphs: Shows how common each value of a discrete variable is.

94
New cards

Density plot: gives us approx the same info as histogram, presents the information as proportions of values represented as a smoothed line.

95
New cards

Center of distribution: Refers to its peak(s) and where it is or they are located

96
New cards

Unimodal: One distinct peak

97
New cards

Bimodal: Two peaks

98
New cards

Multimodal: More peaks

99
New cards

Right-skewed: The long tail is on the right (positive skew)

100
New cards

Left-skewed: The long tail is on the left (negative skewed) very rare.