ASAP in R please provide the code for the following test for independence using the diamond data set: a. Load the diamond data set b. Create separate histograms for the price and carats. Choose categories/ranges for each of these columns of data based on your histograms; there should be between 3 and 5 categories for each. c. Add columns to the diamond data set that has the category for the price and the carat. It is recommened to do steps one at a time and use the mutate function to handle the cases. An example that creates a new column named PriceGroup that has two categories/bins is given below. diamond2 <- diamond2 %>% mutate(PriceGroup = case_when(price <= 400 ~ "Low Price", price > 400 ~ "High Price"))
SQL
SQL stands for Structured Query Language, is a form of communication that uses queries structured in a specific format to store, manage & retrieve data from a relational database.
Queries
A query is a type of computer programming language that is used to retrieve data from a database. Databases are useful in a variety of ways. They enable the retrieval of records or parts of records, as well as the performance of various calculations prior to displaying the results. A search query is one type of query that many people perform several times per day. A search query is executed every time you use a search engine to find something. When you press the Enter key, the keywords are sent to the search engine, where they are processed by an algorithm that retrieves related results from the search index. Your query's results are displayed on a search engine results page, or SER.
ASAP
in R please provide the code for the following test for independence using the diamond data set:
b. Create separate histograms for the price and carats. Choose categories/ranges for each of these columns of data based on your histograms; there should be between 3 and 5 categories for each.
c. Add columns to the diamond data set that has the category for the price and the carat. It is recommened to do steps one at a time and use the mutate function to handle the cases. An example that creates a new column named PriceGroup that has two categories/bins is given below.
diamond2 <- diamond2 %>% mutate(PriceGroup =
case_when(price <= 400 ~ "Low Price",
price > 400 ~ "High Price"))
d. Create a new data frame that has the counts of the data by price and carat category using the table function.
e. Conduct the chi squared independence test to determine if the price and carat of a diamond are independent. State the hypothesis, conclusion, and justification.
f. From the results of the test, extract the expected number of results in each category pair (carat-price). Include the table.
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images