#get the sensor and environment mismatch
library(ggplot2)
library(sf)
## Linking to GEOS 3.11.2, GDAL 3.6.2, PROJ 9.2.0; sf_use_s2() is TRUE
library(tmap)
## The legacy packages maptools, rgdal, and rgeos, underpinning the sp package,
## which was just loaded, will retire in October 2023.
## Please refer to R-spatial evolution reports for details, especially
## https://r-spatial.org/r/2023/05/15/evolution4.html.
## It may be desirable to make the sf package available;
## package maintainers should consider adding sf to Suggests:.
## The sp package is now running under evolution status 2
## (status 2 uses the sf package in place of rgdal)
library(data.table)
library(tidycensus)
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:data.table':
##
## between, first, last
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
library(MASS)
##
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
##
## select
pm<-fread("C:/Users/zhaiw/Dropbox (Personal)/working paper/purpleair/air_pollution/EJSCREEN_2023_BG_with_AS_CNMI_GU_VI.csv")
pm<- pm[,c("ID","PM25")]
pm<-pm[complete.cases(pm$PM25),]
names(pm)[1] <- "GEOID"
library(stringr)
## Warning: package 'stringr' was built under R version 4.3.3
# Assuming your dataframe is named df and the column with GEOID is named GEOID
pm$GEOID <- str_pad(pm$GEOID, width = 12, pad = "0")
#read sensor data
load("C:/Users/zhaiw/Dropbox (Personal)/working paper/purpleair/data/cbg.RData")
load("C:/Users/zhaiw/Dropbox (Personal)/working paper/purpleair/data/US_cbg_msa.RData")
#read sensor data
df<-fread("C:/Users/zhaiw/Dropbox (Personal)/working paper/purpleair/US_sensor_data.csv")
df$uptime<-round(df$uptime/60, 2)
df <- st_as_sf(df, coords = c("longitude", "latitude"), crs = 4326) # 4326 is the CRS for WGS 84
#start from here
df <- st_transform(df, st_crs(cbg))
US_sensor_cbg <- st_join(df, cbg)
US_cbg_msa_census<-merge(US_cbg_msa, cbg, by="GEOID")
#the coverage of cities
sum_count2 <-US_sensor_cbg %>%
group_by(GEOID)%>% summarise(sum_count=n())
sum_count2 <- st_drop_geometry(sum_count2)
sum_count2 <- sum_count2[!is.na(sum_count2$GEOID),]
sum_count2$n <-1
#get the total number of each neighborhood
US_cbg_msa <-merge(US_cbg_msa,sum_count2, by="GEOID", all.x=TRUE)
US_cbg_msa$n[is.na(US_cbg_msa$sum_count)] <- 0
US_cbg_msa$sum_count[is.na(US_cbg_msa$sum_count)] <- 0
cbg_pop <-US_cbg_msa_census[,c('GEOID','poptotal','incomeE')]
US_cbg_msa <- merge(US_cbg_msa, cbg_pop, by="GEOID")
US_cbg_msa <- merge(US_cbg_msa, pm, by="GEOID")
US_cbg_msa$density <- US_cbg_msa$sum_count/US_cbg_msa$poptotal
load("C:/Users/zhaiw/Dropbox (Personal)/working paper/purpleair/data/US_cbg_msa_sum.RData")
##cities more than 100 neighborhoods, 20% sensor coverage
cities<- c('Santa Rosa-Petaluma, CA',
'Santa Cruz-Watsonville, CA',
'Bend, OR',
'San Francisco-Oakland-Fremont, CA',
'Redding, CA',
'San Jose-Sunnyvale-Santa Clara, CA',
'Bellingham, WA',
'Napa, CA',
'Grand Junction, CO',
'Boulder, CO',
'Eugene-Springfield, OR',
'Medford, OR',
'Sacramento-Roseville-Folsom, CA',
'Grants Pass, OR',
'San Luis Obispo-Paso Robles, CA')
for (city in cities){
print(city)
city_cbg <- US_cbg_msa[US_cbg_msa$NAME==city,]
city_cbg <- city_cbg[city_cbg$poptotal>0,]
city_cbg <-city_cbg[complete.cases(city_cbg$density),]
lm_model <- lm(density ~PM25+incomeE, data = city_cbg)
# Extract R-squared value
print(summary(lm_model))
}
## [1] "Santa Rosa-Petaluma, CA"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0033533 -0.0013397 -0.0008002 0.0003307 0.0297998
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.469e-02 4.448e-03 3.303 0.00105 **
## PM25 -2.232e-03 7.009e-04 -3.185 0.00156 **
## incomeE 1.107e-08 4.388e-09 2.523 0.01203 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.003053 on 382 degrees of freedom
## (18 observations deleted due to missingness)
## Multiple R-squared: 0.04246, Adjusted R-squared: 0.03744
## F-statistic: 8.469 on 2 and 382 DF, p-value: 0.0002519
##
## [1] "Santa Cruz-Watsonville, CA"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0025803 -0.0008286 -0.0004666 0.0004227 0.0078693
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.933e-03 5.453e-03 0.905 0.367251
## PM25 -8.818e-04 9.209e-04 -0.958 0.339934
## incomeE 1.398e-08 3.628e-09 3.852 0.000178 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001551 on 139 degrees of freedom
## (7 observations deleted due to missingness)
## Multiple R-squared: 0.1004, Adjusted R-squared: 0.08742
## F-statistic: 7.754 on 2 and 139 DF, p-value: 0.0006419
##
## [1] "Bend, OR"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0016863 -0.0008299 -0.0004639 0.0003444 0.0105234
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.295e-03 9.633e-04 1.344 0.18111
## PM25 -1.579e-04 1.212e-04 -1.302 0.19495
## incomeE 1.224e-08 4.365e-09 2.803 0.00577 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001555 on 142 degrees of freedom
## (6 observations deleted due to missingness)
## Multiple R-squared: 0.05672, Adjusted R-squared: 0.04343
## F-statistic: 4.269 on 2 and 142 DF, p-value: 0.01583
##
## [1] "San Francisco-Oakland-Fremont, CA"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.002428 -0.000886 -0.000383 0.000306 0.038780
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -1.191e-03 7.275e-04 -1.637 0.102
## PM25 9.449e-05 9.401e-05 1.005 0.315
## incomeE 1.148e-08 6.135e-10 18.705 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001858 on 2985 degrees of freedom
## (201 observations deleted due to missingness)
## Multiple R-squared: 0.1094, Adjusted R-squared: 0.1088
## F-statistic: 183.3 on 2 and 2985 DF, p-value: < 2.2e-16
##
## [1] "Redding, CA"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0012520 -0.0004901 -0.0003103 0.0002192 0.0046103
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.500e-03 1.251e-03 2.797 0.00597 **
## PM25 -5.344e-04 2.000e-04 -2.672 0.00853 **
## incomeE 5.201e-09 3.462e-09 1.502 0.13551
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0009224 on 126 degrees of freedom
## (4 observations deleted due to missingness)
## Multiple R-squared: 0.06954, Adjusted R-squared: 0.05477
## F-statistic: 4.709 on 2 and 126 DF, p-value: 0.01066
##
## [1] "San Jose-Sunnyvale-Santa Clara, CA"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0019302 -0.0007759 -0.0003058 0.0002030 0.0152652
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.038e-04 6.956e-04 0.580 0.562
## PM25 -1.553e-04 9.854e-05 -1.576 0.115
## incomeE 1.023e-08 7.916e-10 12.922 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001543 on 1174 degrees of freedom
## (42 observations deleted due to missingness)
## Multiple R-squared: 0.1252, Adjusted R-squared: 0.1237
## F-statistic: 83.97 on 2 and 1174 DF, p-value: < 2.2e-16
##
## [1] "Bellingham, WA"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0020990 -0.0008251 -0.0001928 0.0002240 0.0208855
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.670e-03 1.656e-03 3.425 0.00085 ***
## PM25 -8.160e-04 2.789e-04 -2.926 0.00413 **
## incomeE -4.334e-09 7.076e-09 -0.613 0.54137
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.002101 on 117 degrees of freedom
## (9 observations deleted due to missingness)
## Multiple R-squared: 0.07452, Adjusted R-squared: 0.0587
## F-statistic: 4.71 on 2 and 117 DF, p-value: 0.01078
##
## [1] "Napa, CA"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0033890 -0.0010959 -0.0006343 0.0004381 0.0111626
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.751e-02 3.662e-03 4.781 5.88e-06 ***
## PM25 -2.717e-03 5.612e-04 -4.842 4.58e-06 ***
## incomeE 1.365e-08 5.854e-09 2.332 0.0217 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.002236 on 102 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.2117, Adjusted R-squared: 0.1962
## F-statistic: 13.69 on 2 and 102 DF, p-value: 5.391e-06
##
## [1] "Grand Junction, CO"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0005927 -0.0003665 -0.0002567 0.0001410 0.0034661
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.489e-03 1.821e-03 2.466 0.0155 *
## PM25 -9.507e-04 3.914e-04 -2.429 0.0171 *
## incomeE 3.928e-09 2.778e-09 1.414 0.1608
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0006727 on 91 degrees of freedom
## (7 observations deleted due to missingness)
## Multiple R-squared: 0.09406, Adjusted R-squared: 0.07415
## F-statistic: 4.724 on 2 and 91 DF, p-value: 0.01117
##
## [1] "Boulder, CO"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0016223 -0.0007257 -0.0004943 0.0000542 0.0262055
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.250e-03 1.190e-03 1.891 0.0599 .
## PM25 -2.683e-04 1.640e-04 -1.636 0.1033
## incomeE 3.491e-09 3.320e-09 1.051 0.2942
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.002201 on 217 degrees of freedom
## (9 observations deleted due to missingness)
## Multiple R-squared: 0.01731, Adjusted R-squared: 0.008251
## F-statistic: 1.911 on 2 and 217 DF, p-value: 0.1504
##
## [1] "Eugene-Springfield, OR"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0016351 -0.0005759 -0.0004480 0.0002579 0.0125050
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.455e-03 8.920e-04 3.873 0.000136 ***
## PM25 -3.422e-04 1.031e-04 -3.318 0.001036 **
## incomeE 1.107e-09 3.546e-09 0.312 0.755159
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001404 on 259 degrees of freedom
## (8 observations deleted due to missingness)
## Multiple R-squared: 0.04085, Adjusted R-squared: 0.03344
## F-statistic: 5.515 on 2 and 259 DF, p-value: 0.004512
##
## [1] "Medford, OR"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0020175 -0.0004555 -0.0002202 0.0001787 0.0043828
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.453e-03 1.252e-03 4.354 2.57e-05 ***
## PM25 -7.164e-04 1.617e-04 -4.429 1.89e-05 ***
## incomeE 8.434e-09 3.541e-09 2.382 0.0186 *
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001067 on 140 degrees of freedom
## (7 observations deleted due to missingness)
## Multiple R-squared: 0.1602, Adjusted R-squared: 0.1482
## F-statistic: 13.35 on 2 and 140 DF, p-value: 4.922e-06
##
## [1] "Sacramento-Roseville-Folsom, CA"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.004178 -0.000615 -0.000200 0.000207 0.071854
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 7.359e-03 5.902e-04 12.469 < 2e-16 ***
## PM25 -9.351e-04 7.176e-05 -13.031 < 2e-16 ***
## incomeE 5.064e-09 1.818e-09 2.786 0.00541 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.002869 on 1483 degrees of freedom
## (72 observations deleted due to missingness)
## Multiple R-squared: 0.1126, Adjusted R-squared: 0.1114
## F-statistic: 94.1 on 2 and 1483 DF, p-value: < 2.2e-16
##
## [1] "Grants Pass, OR"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0010918 -0.0003801 -0.0000860 0.0001881 0.0038601
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.772e-03 1.009e-03 3.740 0.000418 ***
## PM25 -5.622e-04 1.531e-04 -3.672 0.000520 ***
## incomeE 1.062e-08 5.512e-09 1.927 0.058751 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.000749 on 59 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.1917, Adjusted R-squared: 0.1643
## F-statistic: 6.998 on 2 and 59 DF, p-value: 0.001874
##
## [1] "San Luis Obispo-Paso Robles, CA"
##
## Call:
## lm(formula = density ~ PM25 + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0009251 -0.0003741 -0.0002160 0.0001060 0.0035337
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 6.567e-04 1.117e-03 0.588 0.557512
## PM25 -1.570e-04 2.120e-04 -0.741 0.459823
## incomeE 5.963e-09 1.754e-09 3.400 0.000844 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0007172 on 167 degrees of freedom
## (9 observations deleted due to missingness)
## Multiple R-squared: 0.0656, Adjusted R-squared: 0.0544
## F-statistic: 5.862 on 2 and 167 DF, p-value: 0.003465
######sensor and heat island###########
#######################################
#######################################
heat<-fread("C:/Users/zhaiw/Dropbox (Personal)/working paper/purpleair/heat/Census_UHI_US_Urbanized_recalculated.csv")
heat <- heat[,c(3,49,50)]
names(heat)[1] <- "CT"
heat$CT <- str_pad(heat$CT, width = 11, pad = "0")
US_cbg_msa$CT <- substr(US_cbg_msa$GEOID, 1, nchar(US_cbg_msa$GEOID) - 1)
US_cbg_msa <- merge(US_cbg_msa, heat, by="CT")
print("UHI_daytime")
## [1] "UHI_daytime"
for (city in cities){
print(city)
city_cbg <- US_cbg_msa[US_cbg_msa$NAME==city,]
city_cbg <- city_cbg[city_cbg$poptotal>0,]
city_cbg <-city_cbg[complete.cases(city_cbg$density),]
lm_model <- lm(density ~UHI_annual_day+incomeE, data = city_cbg)
# Extract R-squared value
print(summary(lm_model))
}
## [1] "Santa Rosa-Petaluma, CA"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0029644 -0.0010133 -0.0004781 0.0002291 0.0234543
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.567e-03 5.344e-04 2.933 0.00369 **
## UHI_annual_day -4.863e-04 9.790e-05 -4.967 1.3e-06 ***
## incomeE 6.429e-09 4.504e-09 1.427 0.15476
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.002318 on 237 degrees of freedom
## (5 observations deleted due to missingness)
## Multiple R-squared: 0.1213, Adjusted R-squared: 0.1139
## F-statistic: 16.36 on 2 and 237 DF, p-value: 2.211e-07
##
## [1] "Santa Cruz-Watsonville, CA"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0023403 -0.0010766 -0.0004268 0.0008885 0.0072422
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.126e-03 7.864e-04 1.432 0.156
## UHI_annual_day -1.223e-04 9.218e-05 -1.327 0.188
## incomeE 6.521e-09 6.316e-09 1.032 0.305
##
## Residual standard error: 0.001785 on 75 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.0441, Adjusted R-squared: 0.01861
## F-statistic: 1.73 on 2 and 75 DF, p-value: 0.1843
##
## [1] "Bend, OR"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0006033 -0.0005748 0.0000990 0.0002929 0.0007624
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.452e-03 1.086e-03 1.337 0.230
## UHI_annual_day 7.618e-06 8.830e-05 0.086 0.934
## incomeE -4.747e-09 1.172e-08 -0.405 0.699
##
## Residual standard error: 0.0005573 on 6 degrees of freedom
## Multiple R-squared: 0.03315, Adjusted R-squared: -0.2891
## F-statistic: 0.1029 on 2 and 6 DF, p-value: 0.9038
##
## [1] "San Francisco-Oakland-Fremont, CA"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.003419 -0.000925 -0.000295 0.000368 0.038215
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -9.996e-05 1.103e-04 -0.906 0.365
## UHI_annual_day -1.399e-04 1.524e-05 -9.181 <2e-16 ***
## incomeE 1.121e-08 6.763e-10 16.579 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001851 on 2482 degrees of freedom
## (141 observations deleted due to missingness)
## Multiple R-squared: 0.1642, Adjusted R-squared: 0.1635
## F-statistic: 243.8 on 2 and 2482 DF, p-value: < 2.2e-16
##
## [1] "Redding, CA"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0010272 -0.0004699 -0.0002550 0.0003099 0.0044451
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.844e-04 2.228e-04 0.828 0.4099
## UHI_annual_day -1.186e-04 5.651e-05 -2.098 0.0385 *
## incomeE 5.856e-09 3.092e-09 1.894 0.0612 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0007692 on 97 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.07341, Adjusted R-squared: 0.0543
## F-statistic: 3.842 on 2 and 97 DF, p-value: 0.02478
##
## [1] "San Jose-Sunnyvale-Santa Clara, CA"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0034435 -0.0007266 -0.0002199 0.0002607 0.0155087
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 9.093e-04 2.020e-04 4.501 7.59e-06 ***
## UHI_annual_day -3.650e-04 3.317e-05 -11.006 < 2e-16 ***
## incomeE 7.255e-09 9.016e-10 8.047 2.47e-15 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001491 on 970 degrees of freedom
## (28 observations deleted due to missingness)
## Multiple R-squared: 0.2273, Adjusted R-squared: 0.2257
## F-statistic: 142.7 on 2 and 970 DF, p-value: < 2.2e-16
##
## [1] "Bellingham, WA"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -6.399e-04 -2.898e-04 4.810e-06 1.855e-04 1.691e-03
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -4.695e-04 2.291e-04 -2.049 0.048432 *
## UHI_annual_day 9.284e-06 4.178e-05 0.222 0.825519
## incomeE 9.958e-09 2.525e-09 3.944 0.000394 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0004383 on 33 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.3362, Adjusted R-squared: 0.296
## F-statistic: 8.356 on 2 and 33 DF, p-value: 0.001158
##
## [1] "Napa, CA"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0017710 -0.0005690 -0.0001734 0.0001484 0.0059334
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.806e-04 4.850e-04 1.197 0.234946
## UHI_annual_day -4.248e-04 1.134e-04 -3.746 0.000342 ***
## incomeE 4.779e-09 4.012e-09 1.191 0.237203
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001185 on 78 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.2037, Adjusted R-squared: 0.1833
## F-statistic: 9.979 on 2 and 78 DF, p-value: 0.0001383
##
## [1] "Grand Junction, CO"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0006581 -0.0004012 -0.0002655 0.0003541 0.0033775
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.208e-04 2.821e-04 0.783 0.437
## UHI_annual_day -3.744e-05 6.217e-05 -0.602 0.549
## incomeE 3.997e-09 3.460e-09 1.155 0.252
##
## Residual standard error: 0.0006933 on 66 degrees of freedom
## (7 observations deleted due to missingness)
## Multiple R-squared: 0.04504, Adjusted R-squared: 0.0161
## F-statistic: 1.556 on 2 and 66 DF, p-value: 0.2185
##
## [1] "Boulder, CO"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0027252 -0.0008599 -0.0003522 0.0000607 0.0245076
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 1.263e-03 5.498e-04 2.298 0.02284 *
## UHI_annual_day -4.387e-04 1.458e-04 -3.008 0.00305 **
## incomeE -1.236e-09 4.514e-09 -0.274 0.78464
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.002437 on 162 degrees of freedom
## (7 observations deleted due to missingness)
## Multiple R-squared: 0.05505, Adjusted R-squared: 0.04338
## F-statistic: 4.719 on 2 and 162 DF, p-value: 0.01019
##
## [1] "Eugene-Springfield, OR"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0008881 -0.0005313 -0.0004163 0.0002625 0.0080132
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 5.074e-04 2.957e-04 1.716 0.088 .
## UHI_annual_day -5.299e-05 4.201e-05 -1.261 0.209
## incomeE 2.061e-09 3.631e-09 0.568 0.571
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001017 on 175 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.01953, Adjusted R-squared: 0.008326
## F-statistic: 1.743 on 2 and 175 DF, p-value: 0.178
##
## [1] "Medford, OR"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0019432 -0.0005231 -0.0001332 0.0001729 0.0045273
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 3.030e-04 3.330e-04 0.910 0.3652
## UHI_annual_day -2.214e-04 4.496e-05 -4.924 3.88e-06 ***
## incomeE 8.528e-09 4.761e-09 1.791 0.0767 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.001085 on 89 degrees of freedom
## (1 observation deleted due to missingness)
## Multiple R-squared: 0.2877, Adjusted R-squared: 0.2717
## F-statistic: 17.97 on 2 and 89 DF, p-value: 2.778e-07
##
## [1] "Sacramento-Roseville-Folsom, CA"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0015514 -0.0003939 -0.0002054 0.0000615 0.0145269
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 2.164e-04 9.105e-05 2.376 0.0177 *
## UHI_annual_day -1.366e-04 2.272e-05 -6.012 2.54e-09 ***
## incomeE 3.973e-09 8.102e-10 4.903 1.09e-06 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0009742 on 1036 degrees of freedom
## (36 observations deleted due to missingness)
## Multiple R-squared: 0.0844, Adjusted R-squared: 0.08263
## F-statistic: 47.75 on 2 and 1036 DF, p-value: < 2.2e-16
##
## [1] "Grants Pass, OR"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -5.672e-04 -3.909e-04 -6.609e-05 2.093e-04 1.314e-03
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 4.606e-04 4.697e-04 0.981 0.339
## UHI_annual_day -1.033e-04 6.354e-05 -1.625 0.121
## incomeE 3.782e-10 6.726e-09 0.056 0.956
##
## Residual standard error: 0.0004771 on 19 degrees of freedom
## (2 observations deleted due to missingness)
## Multiple R-squared: 0.1495, Adjusted R-squared: 0.05993
## F-statistic: 1.669 on 2 and 19 DF, p-value: 0.2148
##
## [1] "San Luis Obispo-Paso Robles, CA"
##
## Call:
## lm(formula = density ~ UHI_annual_day + incomeE, data = city_cbg)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.0011725 -0.0003757 -0.0001227 0.0001184 0.0031873
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) -6.583e-04 2.848e-04 -2.312 0.024297 *
## UHI_annual_day -9.439e-06 6.691e-05 -0.141 0.888292
## incomeE 1.183e-08 3.101e-09 3.816 0.000328 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.0007767 on 59 degrees of freedom
## (3 observations deleted due to missingness)
## Multiple R-squared: 0.2043, Adjusted R-squared: 0.1774
## F-statistic: 7.576 on 2 and 59 DF, p-value: 0.001179