Project

General

Profile

« Previous | Next » 

Revision e50dfd65

Added by Jim Regetz over 12 years ago

  • ID e50dfd65811fed366f6c1aec272a92de32e433a5

switched to more accurate chisq test

View differences:

terrain/research/oregon/arcgis/v2/multiscalesmooth9a_clean.R
52 52
    # prob: prob
53 53
    # bbox: optional extent object used to subset ingrid
54 54

  
55
    # set up chisq parameters
56
    chisqa <- 2.807 - 0.6422 * log10(prob) - 3.410 * prob^0.3411
57
    chisqb <- -5.871 - 3.675 * log10(prob) + 4.690 * prob^0.3377
58
    message("chisq parameters: (", chisqa, ", ", chisqb, ")")
59

  
60 55
    # subset ingrid if desired
61 56
    if (!missing(bbox)) {
62 57
        ingrid <- crop(ingrid, bbox)
......
161 156
        # calc mean noise variance (mean of finer scale variances)
162 157
        mv <- n / w
163 158

  
164
        chisq <- 1 + chisqa / sqrt(n.eff - 1) + chisqb / (n.eff - 1)
159
        # calc chisq critical values
160
        chisq <- calc(n.eff, function(n) qchisq(0.05, n-1,
161
            lower=FALSE)/(n-1))
165 162
        # set coarsened cell variances: if group variance is small
166 163
        # relative to noise variance, use variance of the mean instead
167 164
        # of group variance

Also available in: Unified diff