R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. > ### *
> ### > attach(NULL, name = "CheckExEnv") > assign(".CheckExEnv", as.environment(2), pos = length(search())) # base > ## add some hooks to label plot pages for base and grid graphics > setHook("plot.new", ".newplot.hook") > setHook("persp", ".newplot.hook") > setHook("grid.newpage", ".gridplot.hook") > > assign("cleanEx", + function(env = .GlobalEnv) { + rm(list = ls(envir = env, all.names = TRUE), envir = env) + RNGkind("default", "default") + set.seed(1) + options(warn = 1) + delayedAssign("T", stop("T used instead of TRUE"), + assign.env = .CheckExEnv) + delayedAssign("F", stop("F used instead of FALSE"), + assign.env = .CheckExEnv) + sch <- search() + newitems <- sch[! sch %in% .oldSearch] + for(item in rev(newitems)) + eval(substitute(detach(item), list(item=item))) + missitems <- .oldSearch[! .oldSearch %in% sch] + if(length(missitems)) + warning("items ", paste(missitems, collapse=", "), + " have been removed from the search path") + }, + env = .CheckExEnv) > assign("..nameEx", "__{must remake R-ex/*.R}__", env = .CheckExEnv) # for now > assign("ptime", proc.time(), env = .CheckExEnv) > grDevices::postscript("verification-Examples.ps") > assign("par.postscript", graphics::par(no.readonly = TRUE), env = .CheckExEnv) > options(contrasts = c(unordered = "contr.treatment", ordered = "contr.poly")) > options(warn = 1) > library('verification') Loading required package: fields fields is loaded use help(fields) for an overview of this library Loading required package: waveslim Package verify: Please send comments or suggestions to pocernic@(Remove this)ucar.edu > > assign(".oldSearch", search(), env = .CheckExEnv) > assign(".oldNS", loadedNamespaces(), env = .CheckExEnv) > cleanEx(); ..nameEx <- "attribute" > > ### * attribute > > flush(stderr()); flush(stdout()) > > ### Name: attribute > ### Title: Attribute plot > ### Aliases: attribute attribute.default attribute.prob.bin > ### Keywords: file > > ### ** Examples > > ## Data from Wilks, table 7.3 page 246. > y.i <- c(0,0.05, seq(0.1, 1, 0.1)) > obar.i <- c(0.006, 0.019, 0.059, 0.15, 0.277, 0.377, 0.511, + 0.587, 0.723, 0.779, 0.934, 0.933) > prob.y<- c(0.4112, 0.0671, 0.1833, 0.0986, 0.0616, 0.0366, + 0.0303, 0.0275, 0.245, 0.022, 0.017, 0.203) > obar<- 0.162 > > attribute(y.i, obar.i, prob.y, obar, titl = "Sample Attribute Plot") > > ## Function will work with a ``prob.bin'' class objects as well. > ## Note this is a random forecast. > obs<- round(runif(100)) > pred<- runif(100) > > A<- verify(obs, pred, frcst.type = "prob", obs.type = "binary") If baseline is not included, baseline values will be calculated from the sample obs. > > attribute(A, titl = "Alternative plot", xlab = "Alternate x label" ) > > > > > cleanEx(); ..nameEx <- "brier" > > ### * brier > > flush(stderr()); flush(stdout()) > > ### Name: brier > ### Title: Brier Score > ### Aliases: brier > ### Keywords: file > > ### ** Examples > > > # probabilistic/ binary example > > pred<- runif(100) > obs<- round(runif(100)) > > brier(obs, pred) $baseline.tf [1] FALSE $bs [1] 0.3391037 $bs.baseline [1] 0.2484 $ss [1] -0.3651516 $bs.reliability [1] 0.1030801 $bs.resol [1] 0.01798009 $bs.uncert [1] 0.2484 $y.i [1] 0.05 0.15 0.25 0.35 0.45 0.55 0.65 0.75 0.85 0.95 $obar.i [1] 0.5714286 0.8333333 0.6363636 0.5714286 0.3571429 0.2000000 0.5454545 [8] 0.5333333 0.6363636 0.5000000 $prob.y [1] 0.07 0.06 0.11 0.14 0.14 0.05 0.11 0.15 0.11 0.06 $obar [1] 0.54 > > > > > cleanEx(); ..nameEx <- "conditional.quantile" > > ### * conditional.quantile > > flush(stderr()); flush(stdout()) > > ### Name: conditional.quantile > ### Title: Conditional Quantile Plot > ### Aliases: conditional.quantile > ### Keywords: file > > ### ** Examples > > > set.seed(10) > m<- seq(10, 25, length = 1000) > frcst <- round(rnorm(1000, mean = m, sd = 2) ) > obs<- round(rnorm(1000, mean = m, sd = 2 )) > bins <- seq(0, 30,1) > thrs<- c( 10, 20) # number of obs needed for a statistic to be printed #1,4 quartile, 2,3 quartiles > > conditional.quantile(frcst, obs, bins, thrs, main = "Sample Conditional Quantile Plot") > #### Or plots a ``cont.cont'' class object. > > obs<- rnorm(100) > pred<- rnorm(100) > baseline <- rnorm(100, sd = 0.5) > > A<- verify(obs, pred, baseline = baseline, frcst.type = "cont", obs.type = "cont") > plot(A) > > > > cleanEx(); ..nameEx <- "crps" > > ### * crps > > flush(stderr()); flush(stdout()) > > ### Name: crps > ### Title: Continuous Ranked Probability Score > ### Aliases: crps > ### Keywords: file > > ### ** Examples > > > # probabilistic/ binary example > > x <- runif(100) ## simulated observation. > crps(x, c(0,1)) Warning in return(crps = crps, CRPS = mean(crps), ign = ign, IGN = mean(ign), : multi-argument returns are deprecated $crps [1] 0.2616543 0.2883102 0.3611462 0.5418769 0.2498674 0.5356559 0.5654260 [8] 0.4018222 0.3865815 0.2352175 0.2505607 0.2460987 0.4149248 0.2918401 [15] 0.4591104 0.3305244 0.4307581 0.5969316 0.2906293 0.4633751 0.5589194 [22] 0.2515821 0.3973667 0.2399757 0.2620139 0.2924429 0.2337665 0.2913280 [29] 0.5177676 0.2794664 0.3246550 0.3729599 0.3289450 0.2474893 0.4922153 [36] 0.4056085 0.4729150 0.2383389 0.4339803 0.3002394 0.4884224 0.3951342 [43] 0.4664740 0.3526938 0.3430933 0.4701239 0.2339121 0.3228676 0.4385690 [50] 0.4178346 0.3230105 0.5125668 0.3090621 0.2574832 0.2356871 0.2376387 [57] 0.2732710 0.3386609 0.4024158 0.2988284 0.5448527 0.2678400 0.3163227 [64] 0.2773712 0.3969770 0.2601073 0.3233506 0.4571418 0.2365248 0.5212420 [71] 0.2791271 0.4993998 0.2811691 0.2777314 0.3225455 0.5317592 0.5144815 [78] 0.2936134 0.4633049 0.5759359 0.3079021 0.4280764 0.2966863 0.2755560 [85] 0.4520342 0.2500293 0.4273470 0.2395956 0.2576171 0.2418737 0.2564941 [92] 0.2350802 0.3928396 0.5218286 0.4642032 0.4746761 0.3149864 0.2998601 [99] 0.4825234 0.3753913 $CRPS [1] 0.3629744 $ign [1] 0.9541860 0.9881766 1.0830190 1.3313592 0.9392763 1.3224905 1.3651442 [8] 1.1372654 1.1168308 0.9208473 0.9401513 0.9345247 1.1549387 0.9927064 [15] 1.2152664 1.0427908 1.1764267 1.4108774 0.9911519 1.2211491 1.3557755 [22] 0.9414408 1.1312779 0.9268206 0.9546420 0.9934806 0.9190282 0.9920488 [29] 1.2971196 0.9768573 1.0351392 1.0986781 1.0407300 0.9362770 1.2612118 [36] 1.1423624 1.2343470 0.9247644 1.1808173 1.0035119 1.2559149 1.1282820 [43] 1.2254304 1.0718631 1.0592400 1.2304802 0.9192107 1.0328128 1.1870802 [50] 1.1588770 1.0329988 1.2897794 1.0149031 0.9489014 0.9214363 0.9238853 [57] 0.9689524 1.0534293 1.1380639 1.0016939 1.3356098 0.9620400 1.0243092 [64] 0.9741816 1.1307547 0.9522249 1.0334413 1.2125546 0.9224873 1.3020322 [71] 0.9764238 1.2712686 0.9790333 0.9746414 1.0323938 1.3169475 1.2924799 [78] 0.9949845 1.2210523 1.3803320 1.0134030 1.1727771 0.9989363 0.9718655 [85] 1.2055290 0.9394806 1.1717852 0.9263430 0.9490708 0.9292066 0.9476497 [92] 0.9206752 1.1252056 1.3028624 1.2222926 1.2367892 1.0225759 1.0030230 [99] 1.2476938 1.1019107 $IGN [1] 1.088464 $pit [1] 0.6046912 0.6450997 0.7166280 0.8181158 0.5799173 0.8155111 0.8275877 [8] 0.7456290 0.7353628 0.5246335 0.5815946 0.5700717 0.7539658 0.6495492 [15] 0.7793030 0.6906520 0.7635037 0.8393783 0.6480403 0.7815519 0.8250299 [22] 0.5840021 0.7426942 0.5499579 0.6053504 0.6502939 0.5053418 0.6489132 [29] 0.8077653 0.6332031 0.6851255 0.7256022 0.6891849 0.5738629 0.7959873 [36] 0.7480821 0.7864721 0.5429798 0.7653784 0.6595643 0.7941616 0.7412035 [43] 0.7831667 0.7098807 0.7018468 0.7850481 0.5093070 0.6834008 0.7680115 [50] 0.7557610 0.6835395 0.8054387 0.6693421 0.5966933 0.5281734 0.5396159 [57] 0.6241019 0.6979921 0.7460160 0.6579336 0.8193461 0.6154695 0.6769065 [64] 0.6302044 0.7424349 0.6018030 0.6838689 0.7782543 0.5335699 0.8093005 [71] 0.6327226 0.7993889 0.6355854 0.6307253 0.6830879 0.8138567 0.8062993 [78] 0.6517279 0.7815152 0.8316279 0.6680952 0.7619269 0.6554197 0.6275427 [85] 0.7755012 0.5803122 0.7614954 0.5484285 0.5969609 0.5569751 0.5946912 [92] 0.5234978 0.7396570 0.8095582 0.7819850 0.7873642 0.6755441 0.6591279 [99] 0.7912799 0.7273883 > > ## simulated forecast in which mean and sd differs for each forecast. > frcs<- data.frame( runif(100, -2, 2), runif(100, 1, 3 ) ) > crps(x, frcs) Warning in return(crps = crps, CRPS = mean(crps), ign = ign, IGN = mean(ign), : multi-argument returns are deprecated $crps [1] 0.3910393 0.5822602 0.8932573 0.6411454 0.3505461 1.2330111 1.4963091 [8] 0.4665508 0.6420041 0.5874117 1.0661886 0.4618936 0.8360843 0.7361921 [15] 1.2951406 1.6253753 0.5409311 1.5367795 0.7278515 0.4037688 0.6251538 [22] 0.3268122 0.5061431 0.8608114 0.7443211 0.5363150 0.3543623 1.0122374 [29] 1.1892220 0.6331128 0.4038290 1.6135773 1.5094157 0.5548791 0.5888069 [36] 0.5687876 0.6065425 0.4930527 0.7412574 0.4755369 0.3789173 0.5147350 [43] 1.1156663 0.9445858 0.4602980 0.5910944 0.7948001 0.3764868 1.4426007 [50] 0.7549471 0.5898912 0.7252058 0.7058460 0.5494727 0.4613360 0.8464397 [57] 0.3598968 1.3593021 0.9241992 0.9991816 1.0558330 0.7664599 0.4783442 [64] 0.6971296 0.6866800 0.4189423 1.6071885 0.9005845 0.6394066 0.9394852 [71] 0.2745750 0.3728958 0.6670412 0.4840903 0.5942378 0.4577975 0.3755400 [78] 0.4135788 0.4825978 0.6602369 0.7842439 1.1660162 0.8321952 0.4302417 [85] 0.4538215 0.8897677 0.4089429 0.4844449 0.9551419 0.3377493 0.4393482 [92] 0.3741030 1.3369300 0.5504270 0.9793353 0.5840550 1.3836958 0.5677478 [99] 0.9990038 0.7065931 $CRPS [1] 0.7338927 $ign [1] 1.373980 1.504450 1.897816 1.588025 1.257887 2.134626 2.324946 1.325548 [9] 1.581699 1.818602 2.160377 1.297035 1.970138 2.008076 2.229386 2.543367 [17] 1.753461 2.379625 2.007153 1.446053 1.570179 1.219702 1.510621 1.873300 [25] 2.000401 1.662797 1.334727 2.016329 2.093498 1.915273 1.452109 2.798261 [33] 2.381719 1.750031 1.619802 1.792459 1.812336 1.665534 1.753223 1.583612 [41] 1.398514 1.693759 2.165802 1.869577 1.545725 1.507977 1.791751 1.235393 [49] 2.296455 2.013955 1.844791 1.996154 1.749631 1.729831 1.597573 1.754372 [57] 1.330111 2.227110 1.870777 2.120074 2.010839 1.720114 1.454871 1.911586 [65] 1.862133 1.307790 2.979509 2.000076 1.791218 1.859266 1.049397 1.208383 [73] 1.672995 1.375304 1.565754 1.368272 1.351887 1.317079 1.605734 1.884561 [81] 1.685144 2.088241 2.020535 1.492301 1.245418 1.804421 1.434573 1.364385 [89] 1.885075 1.285931 1.379793 1.231721 2.290613 1.548949 1.953008 1.795769 [97] 2.511949 1.428003 1.992232 1.986199 $IGN [1] 1.758685 $pit [1] 0.4089615 0.7477610 0.7683990 0.2448157 0.4036492 0.8423410 0.8732524 [8] 0.7239797 0.2402600 0.4455895 0.2805568 0.2658660 0.6910293 0.5898999 [15] 0.7954485 0.9348206 0.4749181 0.8125454 0.5810618 0.5513980 0.2491490 [22] 0.5685329 0.6679957 0.7607499 0.3958619 0.6110948 0.4917627 0.9222306 [29] 0.8565650 0.4937393 0.5429061 0.9651877 0.9105959 0.4324562 0.3091294 [36] 0.5461909 0.5915268 0.5007247 0.2564310 0.5791815 0.5221988 0.5444677 [43] 0.7414637 0.8815910 0.4161518 0.7544594 0.7618149 0.3435861 0.8857506 [50] 0.3954138 0.5030094 0.5873485 0.7185215 0.5776355 0.5139532 0.8707789 [57] 0.5526003 0.8665899 0.8128482 0.7061900 0.8067777 0.2155358 0.6675874 [64] 0.3798659 0.3585171 0.6755386 0.9755477 0.7148493 0.3587627 0.8725805 [71] 0.4355037 0.3338210 0.2705274 0.7170082 0.7249103 0.3092057 0.5751777 [78] 0.3366825 0.5722819 0.3988097 0.8836467 0.8283972 0.3390518 0.5709047 [85] 0.2465456 0.8711932 0.4224799 0.2766740 0.1132277 0.4869269 0.3379505 [92] 0.6548911 0.7750410 0.3072774 0.7931274 0.5730340 0.9535720 0.2209294 [99] 0.9189416 0.4269372 > > > > > cleanEx(); ..nameEx <- "discrimination.plot" > > ### * discrimination.plot > > flush(stderr()); flush(stdout()) > > ### Name: discrimination.plot > ### Title: Discrimination plot > ### Aliases: discrimination.plot > ### Keywords: file > > ### ** Examples > > # A sample forecast. > > a<- rnorm(100, mean = -1); b<- rnorm(100, mean = 1) > > A<- cbind(rep(0,100), pnorm(a)); B<- cbind(rep(1,100), pnorm(b)) > > dat<- rbind(A,B); dat<- as.data.frame(dat) > names(dat)<- c("obs", "pred") > > discrimination.plot(dat$obs, dat$pred) > > > > cleanEx(); ..nameEx <- "int.scale.verify" > > ### * int.scale.verify > > flush(stderr()); flush(stdout()) > > ### Name: int.scale.verify > ### Title: Intensity-Scale Verification Model > ### Aliases: int.scale.verify > ### Keywords: file > > ### ** Examples > > > ## simulated example > n<- 5 > set.seed(10) > forecast1 <- matrix( log(rlnorm(n = (2^n *2^n) )) , nrow = 2^n) > obs1 <- matrix(log( rlnorm(n = (2^n *2^n) )) , nrow = 2^n) > int.scale.verify(forecast1, obs1, main = "Test Case") $SSul -3.01 -1.29 -0.81 -0.49 -0.28 0 1 -3.5043988 -3.29088668 -3.3520917 -3.2750787 -3.1938798 -3.2421875 2 -0.1260997 -0.06126912 -0.1723142 -0.1729552 -0.1084704 -0.2055664 3 0.7184751 0.78717355 0.7435216 0.6681257 0.6578819 0.6246338 4 0.9296188 0.93009176 0.9347713 0.9412329 0.9317783 0.9425964 5 0.9765396 0.96027399 0.9773502 0.9907345 0.9948677 0.9984436 bias 1.0000000 0.99415443 0.9949917 0.9996609 0.9946995 0.9992676 0.29 0.59 0.89 1.22 1 -3.2203179 -3.2750787 -3.3887498 -3.2537989 2 -0.3196139 -0.3361791 -0.2778220 -0.2601786 3 0.6383677 0.6802807 0.7061901 0.7387774 4 0.9581409 0.9772637 0.9764450 0.9551096 5 0.9987098 0.9946415 0.9929614 0.9829776 bias 0.9995699 0.9996609 0.9965852 0.9872115 $MSE -3.01 -1.29 -0.81 -0.49 -0.28 1 1.464844e-03 0.1372070312 0.2395019531 3.005371e-01 0.3327636719 2 3.662109e-04 0.0339355469 0.0645141602 8.245850e-02 0.0879516602 3 9.155273e-05 0.0068054199 0.0141143799 2.333069e-02 0.0271453857 4 2.288818e-05 0.0022354126 0.0035896301 4.131317e-03 0.0054130554 5 7.629395e-06 0.0012702942 0.0012464523 6.513596e-04 0.0004072189 bias 0.000000e+00 0.0001869202 0.0002756119 2.384186e-05 0.0004205704 0 0.29 0.59 0.89 1.22 1 3.535156e-01 3.369141e-01 3.005371e-01 0.2402343750 0.1398925781 2 1.004639e-01 1.053467e-01 9.393311e-02 0.0699462891 0.0414428711 3 3.128052e-02 2.886963e-02 2.247620e-02 0.0160827637 0.0085906982 4 4.783630e-03 3.341675e-03 1.598358e-03 0.0012893677 0.0014762878 5 1.296997e-04 1.029968e-04 3.767014e-04 0.0003852844 0.0005598068 bias 6.103516e-05 3.433228e-05 2.384186e-05 0.0001869202 0.0004205704 $l.frcs [1] 32 $thres 0% 10% 20% 30% 40% 50% -3.012163784 -1.286167708 -0.810870055 -0.488905233 -0.275667611 -0.003001333 60% 70% 80% 90% 0.290458829 0.592367766 0.885523004 1.224207690 attr(,"class") [1] "int.scale" > > ## real example. Data source referenced below. > > data(analysis.dat) > data(forecast.dat) > > require(waveslim) [1] TRUE > require(fields) [1] TRUE > > A<- int.scale.verify(forecast.dat, analysis.dat, + thres = c(0, 2^seq(-5,6)), main = "NIMROD example" ) > > plot(A) > > > > > cleanEx(); ..nameEx <- "leps" > > ### * leps > > flush(stderr()); flush(stdout()) > > ### Name: leps > ### Title: Linear Error in Probability Space (LEPS) > ### Aliases: leps leps.default > ### Keywords: file > > ### ** Examples > > obs <- rnorm(100, mean = 1, sd = sqrt(50)) > pred<- rnorm(100, mean = 10, sd = sqrt(500)) > > leps(obs, pred) > > > > > cleanEx(); ..nameEx <- "measurement.error" > > ### * measurement.error > > flush(stderr()); flush(stdout()) > > ### Name: measurement.error > ### Title: Skill score with measurement error. > ### Aliases: measurement.error > ### Keywords: file > > ### ** Examples > > DAT<- data.frame( obs = round(runif(50)), frcs = runif(50)) > > measurement.error(DAT$obs, DAT$frcs) $G [1] 0.8663916 $p [1] 0.1759781 $K [1] 0.2173913 > > ### Finley Data > > measurement.error(c(28, 23, 72, 2680)) ## assuming perfect observation, $G [1] 20.03877 $p [1] 3.794388e-06 $K [1] -0.8627451 > > > > > cleanEx(); ..nameEx <- "observation.error" > > ### * observation.error > > flush(stderr()); flush(stdout()) > > ### Name: observation.error > ### Title: Observation Error > ### Aliases: observation.error > ### Keywords: file > > ### ** Examples > > obs <- round(runif(100)) > gold <- round(runif(100) ) > observation.error(obs, gold) Warning in return(t = n11/(n11 + n01), u = n10/(n10 + n00)) : multi-argument returns are deprecated $t [1] 0.462963 $u [1] 0.5 > > ## Pirep gold standard > > observation.error(c(43,10,17,4) ) Warning in return(t = n11/(n11 + n01), u = n10/(n10 + n00)) : multi-argument returns are deprecated $t [1] 0.7166667 $u [1] 0.7142857 > > > > cleanEx(); ..nameEx <- "plot.int.scale" > > ### * plot.int.scale > > flush(stderr()); flush(stdout()) > > ### Name: plot.int.scale > ### Title: Plot Intensity Scale Objects. > ### Aliases: plot.int.scale > ### Keywords: file > > ### ** Examples > > data(analysis.dat) > data(forecast.dat) > > A<- int.scale.verify(forecast.dat, analysis.dat, thres = c(0, 2^seq(-5,6))) > plot(A) > plot(A, plot.mse = TRUE) > plot(A, main = "Test case") > > > > cleanEx(); ..nameEx <- "reliability.plot" > > ### * reliability.plot > > flush(stderr()); flush(stdout()) > > ### Name: reliability.plot > ### Title: Reliability Plot > ### Aliases: reliability.plot reliability.plot.default > ### reliability.plot.verify > ### Keywords: file > > ### ** Examples > > ## Data from Wilks, table 7.3 page 246. > y.i <- c(0,0.05, seq(0.1, 1, 0.1)) > obar.i <- c(0.006, 0.019, 0.059, 0.15, 0.277, 0.377, 0.511, 0.587, 0.723, 0.779, 0.934, 0.933) > prob.y<- c(0.4112, 0.0671, 0.1833, 0.0986, 0.0616, 0.0366, 0.0303, 0.0275, 0.245, 0.022, 0.017, 0.203) > obar<- 0.162 > > reliability.plot(y.i, obar.i, prob.y, titl = "Test 1", legend.names = + c("Model A") ) > > ## Function will work with a ``prob.bin'' class object as well. > ## Note this is a very bad forecast. > obs<- round(runif(100)) > pred<- runif(100) > > A<- verify(obs, pred, frcst.type = "prob", obs.type = "binary") If baseline is not included, baseline values will be calculated from the sample obs. > > reliability.plot(A, titl = "Alternative plot") > > > > > > cleanEx(); ..nameEx <- "roc.area" > > ### * roc.area > > flush(stderr()); flush(stdout()) > > ### Name: roc.area > ### Title: Area under curve (AUC) calculation for Response Operating > ### Characteristic curve. > ### Aliases: roc.area > ### Keywords: file > > ### ** Examples > # Data used from Mason and Graham (2002). > a<- c(1981, 1982, 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, + 1991, 1992, 1993, 1994, 1995) > b<- c(0,0,0,1,1,1,0,1,1,0,0,0,0,1,1) > c<- c(.8, .8, 0, 1,1,.6, .4, .8, 0, 0, .2, 0, 0, 1,1) > d<- c(.928,.576, .008, .944, .832, .816, .136, .584, .032, .016, .28, .024, 0, .984, .952) > > A<- data.frame(a,b,c, d) > names(A)<- c("year", "event", "p1", "p2") > > ## for model with ties > roc.area(A$event, A$p1) $A.tilda [1] 0.8392857 $n.total [1] 15 $n.events [1] 7 $n.noevents [1] 8 $U [1] 9 $p [1] 0.01394526 $p.adj [1] 0.01164102 > > ## for model without ties > roc.area(A$event, A$p2) $A.tilda [1] 0.875 $n.total [1] 15 $n.events [1] 7 $n.noevents [1] 8 $U [1] 7 $p [1] 0.007543628 $p.adj [1] 0.007543628 > > > > > cleanEx(); ..nameEx <- "roc.plot" > > ### * roc.plot > > flush(stderr()); flush(stdout()) > > ### Name: roc.plot > ### Title: Relative operating characteristic curve. > ### Aliases: roc.plot roc.plot.default roc.plot.prob.bin > ### Keywords: file > > ### ** Examples > > # Data from Mason and Graham article. > > a<- c(0,0,0,1,1,1,0,1,1,0,0,0,0,1,1) > b<- c(.8, .8, 0, 1,1,.6, .4, .8, 0, 0, .2, 0, 0, 1,1) > c<- c(.928,.576, .008, .944, .832, .816, .136, .584, .032, .016, .28, .024, 0, .984, .952) > > A<- data.frame(a,b,c) > names(A)<- c("event", "p1", "p2") > > ## for model with ties > roc.plot(A$event, A$p1) > > ## for model without ties > roc.plot(A$event, A$p2) > > ### show binormal curve fit. > > roc.plot(A$event, A$p2, binormal = TRUE) > > # icing forecast > > data(prob.frcs.dat) > A <- verify(prob.frcs.dat$obs, prob.frcs.dat$frcst/100) If baseline is not included, baseline values will be calculated from the sample obs. > plot(A, titl = "AWG Forecast") > > # plotting a ``prob.bin'' class object. > obs<- round(runif(100)) > pred<- runif(100) > > A<- verify(obs, pred, frcst.type = "prob", obs.type = "binary") If baseline is not included, baseline values will be calculated from the sample obs. > > roc.plot(A, main = "Test 1", binormal = TRUE) > > > > cleanEx(); ..nameEx <- "verify" > > ### * verify > > flush(stderr()); flush(stdout()) > > ### Name: verify > ### Title: Verification function > ### Aliases: verify > ### Keywords: file > > ### ** Examples > > # binary/binary example > obs<- round(runif(100)) > pred<- round(runif(100)) > > A<- verify(obs, pred, frcst.type = "binary", obs.type = "binary") > summary(A) The forecasts are binary, the observations are binary. The contingency table for the forecast pred obs 0 1 0 23 29 1 23 25 PODy = 0.5 TS = 0.3067 ETS = -0.01801 FAR = 0.5577 HSS = -0.03668 PC = 0.48 BIAS = 1.13 > # probabilistic/ binary example > pred<- runif(100) > A<- verify(obs, pred, frcst.type = "prob", obs.type = "binary") If baseline is not included, baseline values will be calculated from the sample obs. > summary(A) The forecasts are probablistic, the observations are binary. Sample baseline calcluated from observations. Brier Score (BS) = 0.2819 Brier Score - Baseline = 0.2496 Skill Score = -0.1295 Reliability = 0.04926 Resolution = 0.01796 Uncertaintity = 0.2496 > # continuous/ continuous example > obs<- rnorm(100) > pred<- rnorm(100) > baseline <- rnorm(100, sd = 0.5) > > A<- verify(obs, pred, baseline = baseline, frcst.type = "cont", obs.type = "cont") > summary(A) The forecasts are continuous, the observations are continous. Baseline data provided. MAE = 1.122 ME = 0.07728 MSE = 2.077 MSE - baseline = 1.092 MSE - persistence = 2.296 SS - baseline = 0.015 > > > > ### *