Presentation Instructions

Make a five-minute presentation on any chosen topic, preferably any topic from the current week’s chapter reading of Data Science for Business, or another topic that would be of interest to most. Do not just summarize the topic, go a little further, such as:

You may also record your presentation instead of presenting in our meetup. Making a presentation in front of a group is strongly encouraged but not required. Our primary focus is on writing R code related to getting and shaping data in preparation for downstream modeling and presentations.


library("DT")
library("tidyr")
library("dplyr")
library("stringr")
library("ggplot2")

NYC Mitchell-Lama Housing

NYC Housing

In many ways, the New York City real estate market is unlike any other in the United States. One of the biggest differences between NYC and Any-Other-Town, USA, is that apartments for sale in NYC are either condos or cooperatives. In most places, condos are the rule but not in the Big Apple. Although cooperatives outnumber condos in NYC - most estimates say about 75% are cooperatives - more condos are on the active market at any given moment. i

Housing Cooperative

Roughly 75 percent of the Manhattan housing inventory is comprised of cooperatives. Unlike a condo, cooperatives are owned by a corporation. This means, when you buy an apartment that is in a cooperative building, you are not actually buying real property (like you would in a condo). You are in fact, buying shares of the corporation. These shares entitle you to a proprietary lease, which relates your relationship to the building close to that of an investor, rather than a condo building, where you are the outright owner of your specific unit. ii

Mitchell-Lama Housing Program

In 1955, New York’s Governor signed into law a bill sponsored by State Senator MacNeill Mitchell and Assemblyman Alfred Lama to encourage and facilitate the construction and continued operation of affordable rental and cooperative housing in the State of New York. The law as we know it is the Mitchell-Lama Program. iii There are both New York City supervised Mitchell-Lama developments and New York State supervised Mitchell-Lama developments. iv

Mitchell-Lama Admission Preference for Veterans

Section 31 of the Private Housing Finance Law was amended effective September 12, 2010 to give Mitchell-Lama admission preference to all veterans, or their surviving spouses, who served on active duty in time of war, as defined in Section 85 of the Civil Service Law, and reside in New York State. v

Rent and Carrying Charge Increases

The housing company prepares the requisite petition, application, or motion for an increase in the maximum rental or carrying charges per room and submit same to HPD for approval as to form and authorization for hearing procedures. vi Proposed rent/carrying charge increases must be sufficient so that total income equals or exceeds total expenses.

NYC Supervised Mitchell-Lama Cooperative Comparison

FOIL Request

Freedom of Information Law requests were made for the most recent “Application for Rent/Carrying Charges Increase” for all New York City and New York State sponsored Mitchell-Lama Buildings. The request made to the NYC Department of Housing Preservation & Development (FOIL Request 908-15) was culled down to applications filed in 2015 (FOIL Request 365-16) after the agency expressed processing constraints. The request made to the NYS Division of Housing and Community Renewal (FOIL Request 359) has yet to be processed.

Documents Obtained

Code Development Units Address Borough Pages
DB_QU Dayton Beach Park 1144 8400 Shore Front Pkwy, Rockaway Beach, NY 11693 Queens 39
DT_QU Dayton Towers 1752 8000 Shore Front Pkwy, Far Rockaway, NY 11693 Queens 30
FA_BK First Atlantic 202 170 S Portland Ave, Brooklyn, NY 11217 Brooklyn 13
FP_MN Franklin Plaza 1633 2085 2nd Ave, New York, NY 10029 Manhattan 37
LP_BK Luna Park 1573 2879 W 12th St, Brooklyn, NY 11224 Brooklyn 49
NG_BK Northside Gardens 41 114 N 5th St, Brooklyn, NY 11211 Brooklyn 22
RG_BX Rosedale Gardens 406 1810 Bruckner Blvd, Bronx, NY 10473 Bronx 24
RT_BK Ryerson Towers 326 309 Lafayette Ave, Brooklyn, NY 11238 Brooklyn 33
SB_MN Stryckers Bay 234 66 W 94th St, New York, NY 10025 Manhattan 14

The cost of reproduction is $0.25 per page.

(39 + 30 + 13 + 37 + 49 + 22 + 24 + 33 + 14) * 0.25
## [1] 65.25

Import Data

wide_data <- read.csv(paste0("https://raw.githubusercontent.com/jzuniga123/SPS/master/",
                        "DATA%20607/DATA_607_Presentation1_1.csv"), stringsAsFactors = F)

Examine Data

names(wide_data)
##  [1] "Category"    "Subcategory" "Description" "DB_QU"       "DT_QU"      
##  [6] "FA_BK"       "FP_MN"       "LP_BK"       "NG_BK"       "RG_BX"      
## [11] "RT_BK"       "SB_MN"
display <- function(data) {
  datatable(data, options = list(
    searching = TRUE,
    pageLength = 10,
    lengthMenu = c(5, nrow(data))
    ), rownames = FALSE)
}
display(wide_data[, -c(1,2)])

Transform Data

long_data <- wide_data %>%
  gather("Development", "Amount", 4:12)
## Warning in combine_vars(vars, ind_list): '.Random.seed' is not an integer
## vector but of type 'NULL', so ignored
display(long_data[, c(4,3,5)])
macro_data <- long_data %>% 
  group_by(Category, Development) %>%
  mutate(Total = ifelse(Category == "Income", sum(Amount), 0)) %>%
  group_by(Development) %>%
  mutate(Income = max(Total)) %>% select(-6) %>% 
  group_by(Category, Development) %>%
  mutate(Total = ifelse(Category == "Expenses", sum(Amount), 0)) %>%
  group_by(Development) %>%
  mutate(Expenses = max(Total)) %>% select(-7) %>% 
  filter(Category == "Grounds") %>% select(-c(1,2)) %>%
  spread(Description, Amount)  %>%  ungroup() %>% 
  select(1,7,8,18,16,17,12,5,15,2,3)
colnames(macro_data) <- c("Development", "Buildings", "Elevators", "Staff", 
  "Rooms", "Apts", "Prof_Units", "Comm_Units", "Staff_Units", "Income", "Expenses")
display(macro_data[, c(1,2,6,10,11)])
micro_data <- long_data %>% 
  group_by(Description, Development) %>%
  mutate(Total = ifelse(Description == "Average Room Rent", sum(Amount), 0)) %>%
  group_by(Development) %>%
  mutate(Room_Rent = max(Total)) %>% select(-6) %>% 
  group_by(Description, Development) %>%
  mutate(Total = ifelse(Description == "Increased Room Rent", sum(Amount), 0)) %>%
  group_by(Development) %>%
  mutate(Inc_Rent = max(Total)) %>% select(-7) %>% 
  filter(Category == "Income" | Category == "Expenses") %>% 
  full_join(macro_data, by = "Development") %>% 
  mutate(Apt_Maint = round((Room_Rent * Rooms * 12) / Apts / 12, 2)) %>% 
  mutate(Inc_Maint = round((Inc_Rent * Rooms * 12) / Apts / 12, 2)) %>% 
  select(4,1,2,3,5,8:11,6,7,12,18,19) 
display(micro_data[, c(1,2,4,5)])

Analysis

Income versus Expenses

inc_exp <- macro_data %>% 
  mutate(Net = Income - Expenses) %>% 
  mutate(Ratio = round(Income / Expenses, 2)) %>% 
  select(1,10,11,12,13)
display(inc_exp)
ggplot(filter(micro_data, Category == "Income"), 
  aes(Development, Amount, fill=Subcategory)) + 
  geom_bar(stat = "identity") +
  labs(y = "Annual Income", title = "Income per Development") +
  theme(plot.title = element_text(hjust = 0.5)) + 
  theme(axis.text.y = element_blank())

ggplot(filter(micro_data, Category == "Expenses"), 
  aes(Development, Amount, fill=Subcategory)) + 
  geom_bar(stat = "identity") +
  labs(y = "Annual Expenses", title = "Expenses per Development") +
  theme(plot.title = element_text(hjust = 0.5)) + 
  theme(axis.text.y = element_blank())

Annual Income Comparison

Median Income

income_coop <- micro_data %>% 
  filter(Category == "Income") %>% 
  select(1,4,5) %>% 
  spread(Development, Amount) %>% 
  mutate(Sum = apply(.[, sapply(., is.numeric)], 1, sum)) %>% 
  filter(Sum != 0) %>% select(-11) 
display((income_coop %>% 
  mutate(Median = apply(.[, sapply(., is.numeric)], 1, median)) %>% 
  mutate_each(funs(ifelse(Median == 0, 
    ifelse(.==0,0,1), (. - Median) / Median)), -c(1,11)) %>% 
  mutate_each(funs(paste0(format(round(. * 100, 2), 
    scientific = F),"%")), -c(1,11)))[, -11])

Standardized Income

ggplot(income_coop %>%
  mutate(Mean = apply(.[, c(2:10)], 1, mean)) %>%
  mutate(SD = apply(.[, c(2:10)], 1, sd)) %>%
  mutate_each(funs((.- Mean) / SD), -c(1,11,12)) %>% 
  select(-c(11,12)) %>% 
  gather(Development, Amount, 2:10),
  aes(x = Development, y = Description)) + 
  geom_tile(aes(fill = Amount)) + 
  scale_fill_gradient(low = 'black', high = 'green', name = "Standing") + 
  theme(axis.title.y = element_blank(), 
  legend.text = element_text(colour = "white"),
  plot.title = element_text(hjust = 0.5)) +
  labs(title = "Standardized Income Comparison")

Annual Expense Comparison

Median Expenses

expenses_coop <- micro_data %>% 
  filter(Category == "Expenses") %>% 
  select(1,4,5) %>% 
  spread(Development, Amount) %>% 
  mutate(Sum = apply(.[, sapply(., is.numeric)], 1, sum)) %>% 
  filter(Sum != 0) %>% select(-11)
display((expenses_coop %>% 
  mutate(Median = apply(.[, sapply(., is.numeric)], 1, median)) %>% 
  mutate_each(funs(ifelse(Median == 0, 
    ifelse(.==0,0,1), (. - Median) / Median)), -c(1,11)) %>% 
  mutate_each(funs(paste0(format(round(. * 100, 2), 
    scientific = F),"%")), -c(1,11)))[, -11])

Standardized Expenses

ggplot(expenses_coop %>%
  mutate(Mean = apply(.[, c(2:10)], 1, mean)) %>%
  mutate(SD = apply(.[, c(2:10)], 1, sd)) %>%
  mutate_each(funs((.- Mean) / SD), -c(1,11,12)) %>% 
  select(-c(11,12)) %>% 
  gather(Development, Amount, 2:10),
  aes(x = Development, y = Description)) + 
  geom_tile(aes(fill = Amount)) + 
  scale_fill_gradient(low = 'black', high = 'red', name = "Standing") + 
  theme(axis.title.y = element_blank(), 
  legend.text = element_text(colour = "white"),
  plot.title = element_text(hjust = 0.5)) +
  labs(title = "Standardized Expense Comparison")

Monthly Income per Unit

income_apt <- micro_data %>% filter(Category == "Income") %>%
  mutate(Amount = round(Amount / Apts / 12, 2)) %>% select(1,3,4,5) 
display(income_apt %>% spread(Development, Amount))
ggplot(income_apt, aes(Development, Amount, fill=Subcategory)) + 
  geom_bar(stat = "identity") +
  labs(y = "Monthly Income", title = "Income per Apartment Unit") +
  theme(plot.title = element_text(hjust = 0.5))

cor((micro_data %>% filter(Category == "Income") %>% 
  mutate(Amount = round(Amount / Apts / 12, 2)) %>% 
  select(1,5,12) %>% group_by(Development) %>% 
  mutate(Amount = sum(Amount)) %>% unique())[, c(2,3)])[[2]]
## [1] 0.06978065

No correlation between size of coop (in units) and income (rent charged).

Monthly Expenses Per Unit

expenses_apt <- micro_data %>%  filter(Category == "Expenses") %>%
  mutate(Amount = round(Amount / Apts / 12, 2)) %>% select(1,3,4,5) 
display(expenses_apt %>% spread(Development, Amount))
ggplot(expenses_apt, aes(Development, Amount, fill=Subcategory)) + 
  geom_bar(stat = "identity") +
  labs(y = "Monthly Expenses", title = "Expenses per Apartment Unit") +
  theme(plot.title = element_text(hjust = 0.5))

cor((micro_data %>% filter(Category == "Expenses") %>% 
  mutate(Amount = round(Amount / Apts / 12, 2)) %>% 
  select(1,5,12) %>% group_by(Development) %>% 
  mutate(Amount = sum(Amount)) %>% unique())[, c(2,3)])[[2]]
## [1] -0.01303967

No correlation between size of coop (in units) and expenses (maintenance costs).

Maintenance Comparison

maintenance <- data.frame(micro_data %>% 
  group_by(Category) %>% 
  mutate(Median_Maint = round(median(Apt_Maint), 2)) %>%  
  ungroup() %>% select(1,13,15) %>% unique() %>% 
  mutate(Dollar_Diff = round(Apt_Maint - Median_Maint, 2)) %>% 
  mutate(Percent_Diff = round((Apt_Maint - Median_Maint) / Median_Maint, 2)))
ggplot(maintenance, aes(x = Development, y = Apt_Maint, fill = Development)) + 
  geom_bar(stat="identity")+ coord_flip() + 
  labs(title = "Average Monthly Maintenance") +
  theme(plot.title = element_text(hjust = 0.5)) + 
  theme(axis.title.x = element_blank()) +
  theme(axis.title.y = element_blank()) +
  theme(axis.text.y = element_blank())

display(maintenance %>%
  mutate(Percent_Diff = paste0(round(Percent_Diff * 100, 2), "%")))

Increased Maintenance Comparison

increases <- data.frame(micro_data %>% 
  group_by(Category) %>% 
  mutate(Median_Maint = round(median(Inc_Maint), 2)) %>%  
  ungroup() %>% select(1,14,15) %>% unique() %>% 
  mutate(Dollar_Diff = round(Inc_Maint - Median_Maint, 2)) %>% 
  mutate(Percent_Diff = round((Inc_Maint - Median_Maint) / Median_Maint, 2)))
ggplot(increases, aes(x = Development, y = Inc_Maint, fill = Development)) + 
  geom_bar(stat="identity")+ coord_flip() + 
  labs(title = "Average Monthly Increased Maintenance") +
  theme(plot.title = element_text(hjust = 0.5)) + 
  theme(axis.title.x = element_blank()) +
  theme(axis.title.y = element_blank()) +
  theme(axis.text.y = element_blank())

display(increases %>%
  mutate(Percent_Diff = paste0(round(Percent_Diff * 100, 2), "%")))

References

i http://www.investopedia.com/articles/personal-finance/090115/living-new-york-city-coops-vs-condos.asp

ii http://www.huffingtonpost.com/greg-jacobs/coop-vs-condo-what-you-ne_b_3460551.html

iii http://www.nychdc.com/pages/Mitchell-Lama-Program.html

iv http://www1.nyc.gov/site/hpd/renters/mitchell-lama-rentals.page

v http://www.nyshcr.org/AboutUs/Offices/HousingOperations/2010_B06.htm

vi https://www1.nyc.gov/assets/hpd/downloads/pdf/renters-mitchell-lama/mitchell-lama-rules.pdf