Hi, loessmodel <- loess(price ~ lat*lon, options) # fiddle with the options locations <- expand.grid() # to make a prediction grid averageprice <- predict(loessmodel, newdata = locations) # not a grid locations$averageprice <- averageprice # to maka it a grid again
Or something along those lines. Of course there are also "better" ways to interpolate. Hope this helps, Arien Aleksandr Andreev wrote:
Hello folks! I'm trying to create some nice graphs for summary statistics in a paper. Here is the issue. I have shapefiles of St Petersburg, Russia, which I can import via spb<- readShapePoly("/home/sasha/Documents/maps/spb.shp") I also have data on apartments in the city. For each apartment, I have the latitude, longitude, and the price. I would like to plot the price on the map in a "heat" style plot. The natural way to do this by computing a local average price for a specified neighborhood around (Lat, Lon) (say, of 0.01 of a degree across -- I have enough data to make this as fine as I need). Does anyone have suggestions on the best way to do this? Thanks! Aleks --------------- Aleksandr Andreev Graduate Student -- Department of Economics University of North Carolina at Chapel Hill _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo
-- Arien Lam Dept. of Physical Geography Utrecht University, NL _______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo