R the component estimation issue

I can't figure out how to get the components to add up to the actual expected count

Changing the names so they make sense…

library(sp)
library(raster)
## raster 2.0-12 (1-September-2012)
setwd("C:\\Users\\mmann1123\\Desktop\\CrapFolder")
load("data.RData")

count4_all_mean_public_land_zero = null  # all variables held at mean, public land all zero
count4_human_mean_public_land_zero_natural_actual = hm_mn_pb_0  # human at mean, natural actual, public land all zer0
count4_human_mean_public_land_one_natural_actual = hm_mn_pb_1  # human at mean, natural actual, public land all one
regular_model_expected_fire_count = all_normal_pb_1  # regular model output (all actual)

Start with the “grey” plot count4_all_mean_public_land_zero

plot(count4_all_mean_public_land_zero, main = "count4_all_mean_public_land_zero")

plot of chunk unnamed-chunk-2

Add each component incrementally

windows()
plot(count4_human_mean_public_land_zero_natural_actual, main = "Turn on natural vaiance")

plot of chunk unnamed-chunk-3

windows()
plot(count4_human_mean_public_land_one_natural_actual, main = "Turn on natural & public land vaiance")

plot of chunk unnamed-chunk-4

windows()
plot(regular_model_expected_fire_count, main = "Turn on natural & public land & human vaiance")

plot of chunk unnamed-chunk-5

color2 = color[length(color):1]
color2[27] = "#BDBDBD"
plot(  hum_effect, main='  Human', col=color2)
windows()
plot(  nat_effect+ pub_effect+hum_effect , main=' all')
windows()
plot( all_normal_pb_1 , main=' actual')

Calculate the individual effects and sum them

nat_effect = (count4_human_mean_public_land_zero_natural_actual)
color = terrain.colors(45)
windows()
color1 = color
color1[1] = "#BDBDBD"
plot((nat_effect), main = "natural", col = color1)

plot of chunk unnamed-chunk-7

pub_effect = (count4_human_mean_public_land_one_natural_actual - count4_human_mean_public_land_zero_natural_actual)
plot((pub_effect), main = "Public land", col = color1)

plot of chunk unnamed-chunk-9

hum_effect = (regular_model_expected_fire_count - count4_human_mean_public_land_one_natural_actual)
color2 = color[length(color):1]
color2[29] = "#BDBDBD"
plot(hum_effect, main = "  Human", col = color2)

plot of chunk unnamed-chunk-11

Sum all effect and compare to actual

plot(nat_effect + pub_effect + hum_effect, main = "Sum of effects")

plot of chunk unnamed-chunk-12

plot(regular_model_expected_fire_count, main = "Actual")

plot of chunk unnamed-chunk-13