Confusion matrix in R

Determine the accuracy of your landcover map

step 1: Install R on your computer

step 2: install the e1071 package in R.


Step 3: Use the confusion matrix algorithm as shown below.


# your reference data
reference =  as.factor(c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4))
# values from your land cover map
prediction = as.factor(c(1,1,3,1,2,4,2,2,3,1,3,3,4,2,4,4))

# get the confusion table
confusionMatrix(prediction, reference, positive = NULL, dnn = c("Prediction", "Reference"))

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s