Open ekmcintyre opened 4 years ago
It is a cluster model problem or a graphing problem?
What does your model produce?
fit <- Mclust( d3 )
summary( fit )
My model seems to be fine.
Did you assign your new groups to your dorling object?
phx$cluster <- as.factor( fit$classification )
That is how the graphic assigns the colors: col="cluster"
tmap_mode("plot")
tmap_style("cobalt")
tm_shape( phx2, bbox=bb ) +
tm_polygons( col="cluster", palette="Accent" )
I assigned cluster 2 and cluster 3.
d22 <- data.frame( dim1, dim2, dim3 )
fit2 <- Mclust( d22 )
summary( fit2 )
msp_dorling$cluster2 <- as.factor( fit2$classification )
d33 <- data.frame( d3$p18und12, d3$pflabf12, d3$hinc12 )
fit3 <- Mclust( d33 )
summary( fit3 )
msp_dorling$cluster3 <- as.factor( fit3$classification )`
Is "cluster" supposed to be from my original cluster groups? If so, I have that code earlier in my file.
set.seed( 1234 )
fit <- Mclust( d3 )
msp_dorling$cluster <- as.factor( fit$classification )
summary( fit )
@ekmcintyre That is correct.
Figured out the empty box was because of this code:
tm_shape( msp_dorling, bbox=bb )
I didn't have a bb object to zoom in on the map. I just got rid of the bbox argument and the cluster map worked.
Got it - you will need to find the edges around your core metro, then just change the xy/min/max values here:
bb <- st_bbox( c( xmin = -12519146,
xmax = -12421368,
ymax = 3965924,
ymin = 3899074 ),
crs = st_crs("+init=epsg:3395"))
That will let you create a bounding box specific to your city.
Which city is it, by the way?
New Orleans
I am not succeeding in creating the cluster models for the last part of the lab. Mine are completely empty.