Conditional Probability

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/9

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

10 Terms

1
New cards

What does the subset() function do in R?

It creates a subset of a dataframe based on specified conditions.

2
New cards

What’s the difference between & and | in R?

& is used for intersections (both conditions must be true), | is used for unions (at least one condition must be true).

3
New cards

How do you find the intersection of high suspension and high enrollment schools?

subset(schools, Total_suspensions > 75 & Enrollment > 611)

4
New cards

What is conditional probability in R?

It’s the probability of an event occurring given a specific condition or subset.

5
New cards

How do you calculate the conditional probability of attendance > 95 in a subset?

unionattenroll$highatt <- unionattenroll$Attendance > 95

mean(unionattenroll$highatt)

6
New cards

How do you compare conditional and unconditional probabilities?

Use mean() on both the subset and full dataset for the same condition.

7
New cards

How do you create a binary indicator for (variable) gifted education > 3?

schools$highgifted <- NA

schools$highgifted[schools$Gifted_education > 3] <- 1

schools$highgifted[schools$Gifted_education <= 3] <- 0

8
New cards

How do you find average enrollment by school level?

aggregate(Enrollment ~ SCHOOL_LEVEL_NAME, data = schools, FUN = mean)

9
New cards

How do you analyze drug infractions across school types?

schools$drugbinary <- ifelse(schools$Drugs > 0, 1, 0)

aggregate(drugbinary ~ SCHOOL_LEVEL_NAME, data = schools, FUN = mean)

10
New cards