by mFidino » Thu May 15, 2014 4:12 pm
So I figured out the matrix math portion, which gives us the variance in a particular site, but am getting some strange results from the rest of the process ( the upper and lower confidence intervals are both higher than the occupancy probability generated through the logistic link). Here is the process that I worked it through, using three sites as an example.
variance to standard error
SE = sqrt (x) / sqrt (y)
x = variance of a site, y = number of sites = 3
Calculate error
error = qnorm(0.975) * x / sqrt(y)
qnorm is the quantile function for a normal distribution, x = SE of a site, y = number of sites = 3
Upper and lower Confidence intervals
lowerConf = mean(x) - error
upperConf = mean(x) + error
x = covariate data
back transform
lowerProbability = 1 / (1 + e^-x)
x = lowerConf for a site
upperProbability = 1 / (1 + e^-x)
x = upperConf for a site
Results from 3 sites worth of data
mean3sites = 0.9882449
var3sites = [ 0.10577993, 0.12578995, 0.13579227 ]
SE = [ 0.1877764, 0.2047681, 0.2127536 ]
error = [ 0.2124851, 0.2317127, 0.2407489 ]
lowerConf = [ 0.7757598, 0.7565322, 0.7474960 ]
upperConf = [ 1.200730, 1.219958, 1.228994 ]
lowerProb = [1.460354, 1.469291, 1.473551 ]
upperProb = [1.300974, 1.295243, 1.292587 ]
I know I made a mistake somewhere in here, as both of these are > 1 and the probability of occupancy for the first few sites is around ~30%.