Australian Population Assignment
- Country :
Australia
Q1.
Given percentages and sample size
percentage_hot_chocolate <- 6 / 100 sample_size <- 309
Calculate the expected number of students who prefer hot chocolate
expected_hot_chocolate <- percentage_hot_chocolate * sample_size
Print the result
print(expected_hot_chocolate)q2
Given student sample data
student_sample <- c(45, 18, 61)
Given Australian population proportions
australian_population <- c(0.46, 0.25, 0.29)
Calculate expected frequencies under the assumption of independence
expected_frequencies <- sum(student_sample) * australian_population
Calculate the chi-squared statistic
chi_squared <- sum((student_sample - expected_frequencies)^2 / expected_frequencies)
Print the chi-squared distance
print(chi_squared)
03a
Given sample data
sample_size <- 261 preferences_per_plan <- c(110, 85, 66)
Calculate the expected number of preferences per plan under uniform distribution
expected_per_plan <- sample_size / length(preferences_per_plan)
Print the expected number of preferences per plan
print(expected_per_plan)
q3b
Given observed preferences and sample size
observed_preferences <- c(110, 85, 66) sample_size <- 261
Calculate the expected number of preferences per plan under uniform distribution
expected_per_plan <- sample_size / length(observed_preferences)
Calculate the chi-squared statistic
chi_squared <- sum((observed_preferences - expected_per_plan)^2 / expected_per_plan)
Calculate the degrees of freedom (number of categories - 1)
df <- length(observed_preferences) - 1
Calculate the p-value using chi-squared distribution
p_value <- 1 - pchisq(chi_squared, df)
Print the test statistic and p-value
cat(“Chi-squared statistic:”, chi_squared, “”) cat(“Degrees of freedom:”, df, “”) cat(“P-value:”, p_value, “”)
q4
Given observed data
observed_data <- matrix(c(55, 37, 37, 71, 53, 28), ncol = 3, byrow = TRUE) rownames(observed_data) <- c(“HR”, “Marketing”) colnames(observed_data) <- c(“Public Transport”, “Driving”, “Bike”)
Calculate row and column totals
row_totals <- rowSums(observed_data) col_totals <- colSums(observed_data)
Calculate the total number of employees
total_employees <- sum(row_totals)
Calculate the proportion of employees who drive
proportion_drive <- col_totals[“Driving”] / total_employees
Calculate the expected number of employees in Marketing who drive
expected_drive_marketing <- proportion_drive * row_totals[“Marketing”]
Print the expected number of employees in Marketing who drive
cat(“Expected number of employees in Marketing who drive:”, expected_drive_marketing, “”)
Are you struggling to keep up with the demands of your academic journey? Don't worry, we've got your back! Exam Question Bank is your trusted partner in achieving academic excellence for all kind of technical and non-technical subjects.
Our comprehensive range of academic services is designed to cater to students at every level. Whether you're a high school student, a college undergraduate, or pursuing advanced studies, we have the expertise and resources to support you.
To connect with expert and ask your query click here Exam Question Bank