All posts tagged: Cities

Los Angeles – No to Measure S

Dear Friends in the City of Los Angeles, For those of you who are residents and are able to vote, there is a ballot measure to take an important stand against in next week’s local elections: Measure S. L.A. Times, Governor Brown, Mayor Garcetti, and many others have came out against this measure, (here, here, here, here, here, here, here, and here) which will basically prohibit development in the City for the next two years and make it extremely difficult in the years after (to be explained below). For those of you that don’t know, the City of Los Angeles like the rest of California, is in the midst of a housing crisis. With a vacancy rate hovering around 2%, the supply of housing is extremely tight and housing costs are skyrocketing. What most people don’t realize is that at around $56,000, the median wage in Los Angeles is actually not that high, yet average home sale prices have now soared above half a million. That is lunacy. Renters are also suffering, with many paying more than 30% of …

Lasso Regression – Machine Learning

Machine Learning Data Analysis This is the third lesson of the fourth course of my Data Analysis and Interpretation Specialization by Wesleyan University through Coursera. If you have been following along with my work, you will know that I am interested in the relationship between urbanization and economic development and am posing the general question of whether urbanization drives economic growth? For this assignment, the goal is to run a Lasso Regression that identifies the impact of each of my explanatory variables: Urban Population, Urban Population Growth, GDP Growth, Population Growth, Employment Rate, and Energy Use per Capita in 2007. As it is a linear regression model, I am able to use a quantitative variable. Unlike the previous lesson, I can use GDP per Capita 2007 as is, without having to convert it into a categorical variable. This time, the training data set is 70% and the test data set is 30% of the original data, which means there are 100 observations in my training data set vs. 43 in my test data set. pred_train.shape = (100, 6) …

Random Forests – Machine Learning

Machine Learning Data Analysis This is the second lesson of the fourth course of my Data Analysis and Interpretation Specialization by Wesleyan University through Coursera. If you have been following along with my work, you will know that I am interested in the relationship between urbanization and economic development and am posing the general question of whether urbanization drives economic growth? For this assignment, the goal is to create a random forest that identifies the varying importance of my explanatory variables: Urban Population, Urban Population Growth, GDP Growth, Population Growth, Employment Rate, and Energy Use per Capita in 2007. For my response variable, I created a categorical variable from GDP per Capita 2007. I separated the data into two levels, where GDP per Capita 2007 is lower than 10000 is 0 or low and where GDP per Capita 2007 is higher than 10000 is 1 or high. Just as in the last assignment, when my test sample is set at 40%, the result is 58 test samples and 85 training samples out of 143 total, with …

Decision Trees – Machine Learning

Machine Learning Data Analysis This is the start of the fourth course of my Data Analysis and Interpretation Specialization by Wesleyan University through Coursera. If you have been following along with my work, you will know that I am interested in the relationship between urbanization and economic development and am posing the general question of whether urbanization drives economic growth? Now, as I have started working, I do not have as much time. For this course, I decided to focus solely on Python, instead of both Python and SAS as in the past. I am not abandoning SAS but I will probably take the time to learn SAS after this course ends. For this assignment, the goal is to create a decision tree that correct classifies samples according to a binary, categorical response variable. For my response variable, I created a categorical variable from GDP per Capita 2007. I separated the data into two levels, where GDP per Capita 2007 is lower than 10000 is 0 or low and where GDP per Capita 2007 is …

Logistics Regression on Economic Development

Last lesson of Regression Modelling in Practice… If you have been following along with my work, you will know that I am interested in the relationship between urbanization and economic development and am posing the general question of whether urbanization drives economic growth? Through the past two courses, Data Analysis Tools and Data Management and Visualization, I looked at the correlation between urbanization and economic development and established that there was a correlation between urban population and GDP per capita. For this last assignment in the course Regression Modelling in Practice, I am again examining GDP per Capita as the response variable. I am using the new data set I created in the last assignment from Gapminer, which as  I explained, holds a more complete set of data if I used the year 2007 instead of 2010. As a logistic regression is performed on a categorical response variable with two levels and multiple explanatory variables, I had to bin GDP per Capita into two and recode them: 0 = Countries with a GDP per Capita less than …

Employment and Urbanization

Continuing with Regression Modelling in Practice… If you have been following along with my work, you will know that I am interested in the relationship between urbanization and economic development and am posing the general question of whether urbanization drives economic growth? Through the past two courses, Data Analysis Tools and Data Management and Visualization, I looked at the correlation between urbanization and economic development and established that there was a correlation between urban population and GDP per capita. For this assignment, I decided to look at another measure of economic development – employment rate. However, because data for 2010 is unavailable for some of the new variables I wanted to include, I decided to use data from the year 2007. It is the most recent year where I get the most data for all my variables. For each of the variables, I downloaded data directly from Gapminder and extracted the relevant information for 2007 and compiled a new CSV file. I define my response variable as Employment Rate in 2007. Now that my data …

Basic Regression on Urban Population Growth and GDP per Capita

Continuing with Regression Modelling in Practice… If you have been following along with my work, you will know that I am interested in the relationship between urbanization and economic development and am posing the general question of whether urbanization drives economic growth? Through the past two courses, Data Analysis Tools and Data Management and Visualization, I established that there was a correlation between urban population and GDP per capita. For this assignment, my primary explanatory variable is Urban Population Growth rate and response variable is GDP per capita, both figures are from 2010. This is my code in Python: import pandas import numpy import seaborn import matplotlib.pyplot as plt import statsmodels.formula.api as smf import statsmodels.stats.multicomp as multi gapminder = pandas.read_csv(‘Data1.csv’, low_memory=False) gapminder[‘GDP2010’] = gapminder[‘GDP2010’].replace(0,numpy.nan) gapminder[‘GDPGrowth2010’] = gapminder[‘GDPGrowth2010’].replace(0,numpy.nan) gapminder[‘UrbanPop2010’] = gapminder[‘UrbanPop2010’].replace(0,numpy.nan) gapminder[‘UrbanPopGrowth2010’] = gapminder[‘UrbanPopGrowth2010’].replace(0,numpy.nan) gapminder = gapminder[[‘Country’, ‘UrbanPop2010’, ‘UrbanPopGrowth2010’, ‘GDP2010’, ‘GDPGrowth2010’]] gapminder = gapminder.dropna() PopDes = gapminder[‘UrbanPopGrowth2010’].describe() print (PopDes) RegData = gapminder[[‘Country’, ‘UrbanPopGrowth2010’, ‘GDP2010’]] RegData[‘UrbanPopGrowth2010’] = RegData[‘UrbanPopGrowth2010’] – RegData[‘UrbanPopGrowth2010′].mean() print (RegData.describe()) UrbanReg = smf.ols(formula=’GDP2010 ~ UrbanPopGrowth2010′, data=RegData).fit() print (UrbanReg.summary()) seaborn.regplot(x=’UrbanPopGrowth2010′, y=’GDP2010’, fit_reg=True, data=RegData) plt.xlabel(‘Urban Population Growth …