Krigging-Creating a heat map with predicted values.

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

Krigging-Creating a heat map with predicted values.


I have the following data, that contains all the values that have been measured for RLevel.

I followed the following link that tells how to use krigging.

This is the following code I wrote. Before these steps, I had removed all the values from my DieData that
needed values to be tested. The values that need to be tested are refered as in my code.

#Step3: Convert to SpatialPointsDataFrame Object
coordinates( = ~X+Y

#Step 4: Get the prediction Grid

#Using autokride method
kr = autoKrige(RLevel,,,nmax=20)
predicted_die_values <- kr$krige_output
predicted_die_model <- kr$var_model

#Get Predictions. Plot the predicted on heat map.
g <- gstat(NULL,"RLevel",RLevel~1,, model=predicted_die_model,nmax=1)
predictedSet <- predict(g,,BLUE=TRUE)

#Plot the krigging graph
predicted_die_values %>% %>% ggplot(aes(x=X,y=Y)) + geom_tile(aes(fill=v1.pred))+coord_equal() +scale_fill_gradient(low="yellow",high="red")+scale_x_continuous()+scale_y_continuous()+theme_bw()

When I plot the graph, I get the following image from  the values that have been tested by the KRIGING METHOD.

My question is how can I show a good heat map with predicted points from KRIG and from the points already have. I want my graph to show something like this from the link above I had posted.