{"id":23024497,"url":"https://github.com/derrickbaruga7/r-linear-model","last_synced_at":"2025-04-02T19:41:08.566Z","repository":{"id":250328535,"uuid":"834150216","full_name":"derrickbaruga7/R-Linear-Model","owner":"derrickbaruga7","description":"This R project focuses on predicting housing prices based on various features such as building area, number of rooms, and more. The dataset used is cleaned and analyzed to build a predictive model using linear regression.","archived":false,"fork":false,"pushed_at":"2024-07-26T14:29:47.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-08T10:20:31.485Z","etag":null,"topics":["data-science","linear-modeling","r","visualization"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/derrickbaruga7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-26T14:23:10.000Z","updated_at":"2024-07-26T14:29:50.000Z","dependencies_parsed_at":"2024-07-26T16:21:21.989Z","dependency_job_id":null,"html_url":"https://github.com/derrickbaruga7/R-Linear-Model","commit_stats":null,"previous_names":["derrickbaruga7/r-linear-model"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrickbaruga7%2FR-Linear-Model","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrickbaruga7%2FR-Linear-Model/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrickbaruga7%2FR-Linear-Model/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/derrickbaruga7%2FR-Linear-Model/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/derrickbaruga7","download_url":"https://codeload.github.com/derrickbaruga7/R-Linear-Model/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246882907,"owners_count":20849334,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["data-science","linear-modeling","r","visualization"],"created_at":"2024-12-15T13:19:12.969Z","updated_at":"2025-04-02T19:41:08.519Z","avatar_url":"https://github.com/derrickbaruga7.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# R-Linear-Model\nThis R project focuses on predicting housing prices based on various features such as building area, number of rooms, and more. The dataset used is cleaned and analyzed to build a predictive model using linear regression.\n\nRequirements\n\nR version 4.3.1 or later\nR packages:\ntidyverse 2.0.0\ntidymodels 1.1.1\nInstallation\n\nInstall the required R packages using the following commands:\n\ninstall.packages(\"tidyverse\")\ninstall.packages(\"tidymodels\")\n\nUsage\n\n1. Load the necessary libraries:\n\nlibrary(tidyverse)\nlibrary(tidymodels)\n\n2. Clean the data by removing rows with missing values:\n\nhousing_data_clean \u003c- drop_na(housing_data)\n\n3. Examine the correlation between numeric features:\n\ncor(housing_data_clean[, sapply(housing_data_clean, is.numeric)])\n\n4. Create scatter plots for initial visualization:\n\nggplot(housing_data_clean, aes(x = BuildingArea, y = Price)) +\n  geom_point() +\n  labs(title = \"Price vs Building Area\")\n\n5. Split the data into training and testing sets:\n\nset.seed(123)\ndata_split \u003c- initial_split(housing_data_clean, prop = 0.75)\ntrain_data \u003c- training(data_split)\ntest_data \u003c- testing(data_split)\n\n6. Identify and remove outliers based on calculated fences:\n\ncalculate_fences \u003c- function(data, column) {\n  Q1 \u003c- quantile(data[[column]], 0.25)\n  Q3 \u003c- quantile(data[[column]], 0.75)\n  IQR \u003c- Q3 - Q1\n  list(lower = Q1 - 1.5 * IQR, upper = Q3 + 1.5 * IQR)\n}\n\nprice_fences \u003c- calculate_fences(train_data, \"Price\")\nbuilding_area_fences \u003c- calculate_fences(train_data, \"BuildingArea\")\n\ntrain_data \u003c- train_data %\u003e%\n  filter(Price \u003e price_fences$lower, Price \u003c price_fences$upper) %\u003e%\n  filter(BuildingArea \u003e building_area_fences$lower, BuildingArea \u003c building_area_fences$upper)\n\n7. Build the linear regression model:\n\nmodel \u003c- lm(Price ~ BuildingArea, data = train_data)\n\n8. Predict and visualize the results:\n\ntest_data$Predicted_Price \u003c- predict(model, test_data)\n\nggplot(test_data, aes(x = BuildingArea, y = Price)) +\n  geom_point(aes(color = \"Actual\")) +\n  geom_point(aes(y = Predicted_Price, color = \"Predicted\")) +\n  labs(title = \"Actual vs Predicted Prices\")\n  \nLicense\n\nThis project is licensed under the terms of the R Foundation for Statistical Computing.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderrickbaruga7%2Fr-linear-model","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fderrickbaruga7%2Fr-linear-model","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fderrickbaruga7%2Fr-linear-model/lists"}