Skip to content

Latest commit

 

History

History
88 lines (73 loc) · 2.18 KB

model-02.md

File metadata and controls

88 lines (73 loc) · 2.18 KB

Thesis - Model

After failing to come up with meaningful results in model-01 attempt with a linear regression model predicting approved budget, we will now examine the different parameters correlated with varying degrees of SELA budget usage.

Load libraries

library(tidyverse)
library(tidymodels)
library(modelr)
library(corrr)
library(ggfortify)

Selecting relevant variables

sela_df <- df %>% 
  select(
    name,
    muni_id,
    district,
    type,
    pop,
    likud_pct,
    coal_pct,
    ses_2013_c,
    peri_2004_c,
    sa_data,
    sector,
    is_nat_pri,
    starts_with("budget")
  )
Error in UseMethod("select"): no applicable method for 'select' applied to an object of class "function"

Checking eligibility for both SELA budget types

Add variables for eligibilty

sela_df <- sela_df %>% 
  mutate(
    is_elig_fest = case_when(
      pop > 100000 ~ FALSE,
      ses_2013_c > 7 ~ FALSE,
      ses_2013_c < 7 ~ TRUE,
      type == "מועצה אזורית" & peri_2004_c <= 2 ~ TRUE,
      is_nat_pri ~ TRUE,
      TRUE ~ FALSE
    )
  )
Error in mutate(., is_elig_fest = case_when(pop > 1e+05 ~ FALSE, ses_2013_c > : object 'sela_df' not found
sela_df %>% 
  group_by(is_elig_fest) %>% 
  summarise(sum = sum(budget_approved_fest))
Error in group_by(., is_elig_fest): object 'sela_df' not found
check <- sela_df %>% 
  filter(!is_elig_fest & budget_approved_fest > 0)
Error in filter(., !is_elig_fest & budget_approved_fest > 0): object 'sela_df' not found