Contains the type of properties and the buyer types. Buyer categories are: "single male", "single female", "married couple" and "family".
The type of property these buyers purchased were sorted into four categories: "flat", "bungalow" (i.e., a one-storey home), "detached house" and "terrace" (i.e., a block of adjoining houses).
Chi-square test of independence can be used to assess the association between the type of buyer who purchases a property and the type of property that is purchased.
For a worked tutorial on this analysis, see the Datanovia lesson “Chi-Square Test of Independence in R: Are Two Variables Associated?” (https://www.datanovia.com/learn/biostatistics/categorical/chi-square-test-of-independence-in-r).
data("properties")A data frame with 333 rows and 2 columns (stored as a tibble).
the type of property purchased: "flat", "bungalow", "detached house" or "terrace".
the type of buyer: "single male", "single female", "married couple" or "family".
A simulated dataset for teaching the chi-square test of independence.
Datanovia tutorial: Chi-Square Test of Independence in R: Are Two Variables Associated?.
data("properties")
head(properties)
#> # A tibble: 6 × 2
#> property_type buyer_type
#> <fct> <fct>
#> 1 flat single male
#> 2 flat single male
#> 3 flat single male
#> 4 flat single male
#> 5 flat single male
#> 6 flat single male
# Chi-square test of independence between buyer type and property type
chisq.test(table(properties$property_type, properties$buyer_type))
#>
#> Pearson's Chi-squared test
#>
#> data: table(properties$property_type, properties$buyer_type)
#> X-squared = 82.504, df = 9, p-value = 5.134e-14
#>