Package crossrun. October 8, 2018

Similar documents
Package SEMrushR. November 3, 2018

Package cattonum. R topics documented: May 2, Type Package Version Title Encode Categorical Features

Package bisect. April 16, 2018

Package fastdummies. January 8, 2018

Package ECctmc. May 1, 2018

Package validara. October 19, 2017

Package jdx. R topics documented: January 9, Type Package Title 'Java' Data Exchange for 'R' and 'rjava'

Package datasets.load

Package geojsonsf. R topics documented: January 11, Type Package Title GeoJSON to Simple Feature Converter Version 1.3.

Package mgc. April 13, 2018

Package gtrendsr. October 19, 2017

Package gggenes. R topics documented: November 7, Title Draw Gene Arrow Maps in 'ggplot2' Version 0.3.2

Package splithalf. March 17, 2018

Package calpassapi. August 25, 2018

Package stapler. November 27, 2017

Package rprojroot. January 3, Title Finding Files in Project Subdirectories Version 1.3-2

Package canvasxpress

Package wrswor. R topics documented: February 2, Type Package

Package balance. October 12, 2018

Package fusionclust. September 19, 2017

Package kirby21.base

Package IATScore. January 10, 2018

Package WordR. September 7, 2017

Package repec. August 31, 2018

Package kdtools. April 26, 2018

Package gtrendsr. August 4, 2018

Package docxtools. July 6, 2018

Package rsppfp. November 20, 2018

Package diffusr. May 17, 2018

Package editdata. October 7, 2017

Package ggimage. R topics documented: November 1, Title Use Image in 'ggplot2' Version 0.0.7

Package raker. October 10, 2017

Package barcoder. October 26, 2018

Package shinyfeedback

Package nmslibr. April 14, 2018

Package RNAseqNet. May 16, 2017

Package condusco. November 8, 2017

Package modmarg. R topics documented:

Package fitbitscraper

Package readxl. April 18, 2017

Package Numero. November 24, 2018

Package ggimage. R topics documented: December 5, Title Use Image in 'ggplot2' Version 0.1.0

Package attrcusum. December 28, 2016

Package spark. July 21, 2017

Package epitab. July 4, 2018

Package rucrdtw. October 13, 2017

Package BASiNET. October 2, 2018

Package mixsqp. November 14, 2018

Package sfc. August 29, 2016

Package qualmap. R topics documented: September 12, Type Package

Package semver. January 6, 2017

Package qicharts2. March 3, 2018

Package zoomgrid. January 3, 2019

Package mdftracks. February 6, 2017

Package ether. September 22, 2018

Package data.world. April 5, 2018

Package tropicalsparse

Package projector. February 27, 2018

Package weco. May 4, 2018

Package robotstxt. November 12, 2017

Package rzeit2. January 7, 2019

Package TrafficBDE. March 1, 2018

Package phrasemachine

Package samplesizecmh

Package FractalParameterEstimation

Package EvolutionaryGames

Package elmnnrcpp. July 21, 2018

Package mmpa. March 22, 2017

Package humanize. R topics documented: April 4, Version Title Create Values for Human Consumption

Package opencage. January 16, 2018

Package PCADSC. April 19, 2017

Package spelling. December 18, 2017

Package knitrprogressbar

Package triebeard. August 29, 2016

Package rnn. R topics documented: June 21, Title Recurrent Neural Network Version 0.8.1

Package fastrtext. December 10, 2017

Package catenary. May 4, 2018

Package RODBCext. July 31, 2017

Package Rtsne. April 14, 2017

Package pwrab. R topics documented: June 6, Type Package Title Power Analysis for AB Testing Version 0.1.0

Package lumberjack. R topics documented: July 20, 2018

Package nlgeocoder. October 8, 2018

Package tiler. June 9, 2018

Package gifti. February 1, 2018

Package estprod. May 2, 2018

Package omu. August 2, 2018

Package metaheur. June 30, 2016

Package redux. May 31, 2018

Package ecoseries. R topics documented: September 27, 2017

Package pdfsearch. July 10, 2018

Package censusr. R topics documented: June 14, Type Package Title Collect Data from the Census API Version 0.0.

Package jpmesh. December 4, 2017

Package facerec. May 14, 2018

Package censusapi. August 19, 2018

Package vesselr. R topics documented: April 3, Type Package

Package fitur. March 11, 2018

Package sigqc. June 13, 2018

Package dkanr. July 12, 2018

Package jstree. October 24, 2017

Package tidytransit. March 4, 2019

Transcription:

Version 0.1.0 Package crossrun October 8, 2018 Title Joint Distribution of Number of Crossings and Longest Run Joint distribution of number of crossings and the longest run in a series of independent Bernoulli trials. The computations uses an iterative procedure where computations are based on results from shorter series. The procedure conditions on the start value and partitions by further conditioning on the position of the first crossing (or none). Depends R (>= 3.5) License GPL-3 Encoding UTF-8 URL https://github.com/torewentzel-larsen/crossrun LazyData true Imports Rmpfr (>= 0.7-1) RoxygenNote 6.1.0 Suggests knitr, rmarkdown VignetteBuilder knitr NeedsCompilation no Author Tore Wentzel-Larsen [aut, cre], Jacob Anhøj [aut] Maintainer Tore Wentzel-Larsen <tore.wentzellarsen@gmail.com> Repository CRAN Date/Publication 2018-10-08 14:20:10 UTC R topics documented: boxprobt........................................... 2 clshift............................................ 3 crossrunbin......................................... 3 crossrunchange....................................... 4 1

2 boxprobt crossrunshift......................................... 5 crossrunsymm........................................ 5 cumsumm.......................................... 6 cumsummcol........................................ 7 exactbin........................................... 7 joint100.6.......................................... 8 joint100symm........................................ 8 joint15.6........................................... 9 joint15symm........................................ 9 joint60.6........................................... 10 joint60symm........................................ 10 simclbin........................................... 11 Index 12 boxprobt Box Cumulative Sums A box cumulative sum is defined as the cumulative sum over a lower left rectangle. This function is primarily for use when the components are point probabilities for the number of crossings C and the longest run L, then component (c,l) in the result is the probability P (C c, L l). boxprobt(mtrx) mtrx mpfr array mpfr array nill <- Rmpfr::mpfr(0, 120) one <- Rmpfr::mpfr(1, 120) two <- Rmpfr::mpfr(2, 120) contents <- c(one,nill,nill, one,one,one, two,two,two) mtrx3 <- Rmpfr::mpfr2array(contents, dim = c(3, 3)) print(mtrx3) print(boxprobt(mtrx3))

clshift 3 clshift Number of Crossings and Longest Run Auxiliary function for simclbin, computing the number of crossings (type=0) or longest run (type=2) in a sequence of independent normal observations. Crossings and runs are related to whether the observations are above a shift. clshift(seri, shift = 0, type = 0) seri shift type numeric; seri a sequence of random draws numeric; shift for the observatoobs numeric; 0 number of crossings, 1 longest run number of crossings or longest run, numeric crossrunbin Joint Distribution for Crossings and Runs Joint probability distribution for the number of crossings C and the longest run L in a sequence of n independent Bernoulli observations with success probability p. To enhance precision, results are stored in mpfr arrays and the probabilities are multiplied by m n 1 for a multiplier m. crossrunbin(nmax = 100, prob = 0.5, mult = 2, prec = 120, printn = FALSE) nmax prob mult prec printn max sequence length. success probability. multiplier for joint probabilities. mpft precision. logical for progress output.

4 crossrunchange list of joint probabilities. crb10.6 <- crossrunbin(nmax=10, prob=.6, printn=true) print(crb10.6$pt[[10]]) crossrunchange Joint Distribution for Crossings and Runs, Varying Success Probability. Joint probability distribution for the number of crossings C and the longest run L in a sequence of n independent Bernoulli observations with p ossibly varying success probability. To enhance precision, results are stored in mpfr arrays and the probabilities are multiplied by m n 1 for a multiplier m. crossrunchange(nmax = 100, prob = rep(0.5, 100), mult = 2, prec = 120, printn = FALSE) nmax prob mult prec printn max sequence length. success probabilities. multiplier for joint probabilities. mpft precision. logical for progress output. list pt of joint probabilities. Cumulative probabilities qt within each row are also included. Further, mostly for code checking, lists pat and qat conditional on starting with a success, and pbt and qbt conditional of starting with a failure, are included. prob10 <- c(rep(.5,5),rep(.7,5)) crchange10 <- crossrunchange(nmax=10, prob=prob10,printn=true) print(crchange10$pt[[10]])

crossrunshift 5 crossrunshift wrapper for crossrunbin, succes probability=pnorm(shift). wrapper for crossrunbin, succes probability=pnorm(shift). crossrunshift(nmax = 100, shift = 0, mult = 2, prec = 120, printn = FALSE) nmax shift mult prec printn max sequence length. mean of normal distribution. multiplier for joint probabilities. mpft precision. logical for progress output. list pt of joint probabilities. Cumulative probabilities qt within each row are also included. Further, mostly for code checking, lists pat and qat conditional on starting with a success, and pbt and qbt conditional of starting with a failure, are included. crs20 <- crossrunshift(nmax=20,printn=true) print(crs20$pt[[20]]) crossrunsymm Joint Probabilities for Crossings and Runs, Symmetric Case Joint probability distribution for the number of crossings C and the longest run L in a sequence of n independent Bernoulli observations with success probability p. To enhance precision, results are stored in mpfr arrays and the probabilities are multiplied by m n 1 for a multiplier m. This is for the symmetric case with success probability 0.5, in which the multiplied probabilities are integers for the default value 2 of the multiplier. crossrunsymm(nmax = 100, mult = 2, prec = 120, printn = FALSE)

6 cumsumm nmax ; max sequence length. mult ; multiplier for joint probabilities. Default 2. prec ; mpft precision. printn ; logical for including progress output. pt, list of joint probabilities, multiplied with m n 1. In addition cumulative probabilities qt within each row are also included. crs10 <- crossrunsymm(nmax=10,printn=true) cumsumm Row-wise Cumulative Sums Row-wise Cumulative Sums in mpfr Array. cumsumm(mtrx) mtrx mpfr two-dimensional array. mpfr array with row-wise cumulative sums, same dimension as the original array. nill <- Rmpfr::mpfr(0, 120) one <- Rmpfr::mpfr(1, 120) two <- Rmpfr::mpfr(2, 120) contents <- c(one,nill,nill, one,one,one, two,two,two) mtrx3 <- Rmpfr::mpfr2array(contents, dim = c(3, 3)) print(mtrx3) print(cumsumm(mtrx3))

cumsummcol 7 cumsummcol Column-Wise Cumulative Sums Column-wise cumulative sums in mpfr array. cumsummcol(mtrx) mtrx mpfr two-dimensional array. mpfr array with column-wise cumulative sums, same dimension as the original array. nill <- Rmpfr::mpfr(0, 120) one <- Rmpfr::mpfr(1, 120) two <- Rmpfr::mpfr(2, 120) contents <- c(one,nill,nill, one,one,one, two,two,two) mtrx3 <- Rmpfr::mpfr2array(contents, dim = c(3, 3)) print(mtrx3) print(cumsummcol(mtrx3)) exactbin Exact Joint Probabilities for Low n Exact joint probabilities, for low n, of the number of crossings C and the longest run L in n independent Bernoulli observations with success probability p. Probabilites are multiplied by 2 n 1. exactbin(n, p = 0.5, prec = 120) n number, length of seqience, at most 6. p success probability. prec precision in mpfr calculations. Default 120.

8 joint100symm mpfr array exactbin(n=6) exactbin(n=5, p=0.6) joint100.6 Joint probabilities, n=100, success probability 0.6 Format Source The joint probabilities of the number C og crossings (0,... 99) and the longest run L (1,..., 100) in a series of n=100 independent Bernoulli observations for success probability 0.6. The probabilities are stored in the "times" representations, multiplied by 2 100 1. Only the joint distributions for n=15, 60, 100 and success probabilities 0.5 and 0.6 are included in the package to avoid excessive storage, but many more cases are generated in the script crossrun1.r. joint100.6 matrix, 100 rows and 100 columns generated by the function crossrunbin and transformed from an Rmpfr array to a matrix joint100symm Joint probabilities, n=100, symmetric case The joint probabilities of the number C og crossings (0,... 99) and the longest run L (1,..., 100) in a series of n=100 independent Bernoulli observations for the symmetric case (success probability 0.5). The probabilities are stored in the "times" representations, multiplied by 2 100 1 and are integers in the symmetric case. Only the joint distributions for n=15, 60, 100 and success probabilities 0.5 and 0.6 are included in the package to avoid excessive storage, but many more cases are generated in the script crossrun1.r. joint100symm

joint15.6 9 Format matrix, 100 rows and 100 columns Source generated by the function crossrunsymm and transformed from an Rmpfr array to a matrix joint15.6 Joint probabilities, n=15, success probability 0.6 Format Source The joint probabilities of the number C og crossings (0,... 14) and the longest run L (1,..., 15) in a series of n=15 independent Bernoulli observations for success probability 0.6. The probabilities are stored in the "times" representations, multiplied by 2 15 1 = 16348. Only the joint distributions for n=15, 60, 100 and success probabilities 0.5 and 0.6 are included in the package to avoid excessive storage, but many more cases are generated in the script crossrun1.r. joint15.6 matrix, 15 rows and 15 columns generated by the function crossrunbin and transformed from an Rmpfr array to a matrix joint15symm Joint probabilities, n=15, symmetric case Joint probabilities of the number C of crossings (0,... 14) and the longest run L (1,..., 15) in a series of n=15 independent Bernoulli observations for the symmetric case (success probability 0.5). The probabilities are stored in the "times" representations, multiplied by 2 15 1 = 16348 and are integers in the symmetric case. Only the joint distributions for n=15, 60, 100 and success probabilities 0.5 and 0.6 are included in the package to avoid excessive storage, but many more cases are generated in the script crossrun1.r. joint15symm

10 joint60symm Format matrix, 15 rows and 15 columns Source generated by the function crossrunsymm and transformed from an Rmpfr array to a matrix joint60.6 Joint probabilities, 60, success probability 0.6 Format Source The joint probabilities of the number C og crossings (0,... 59) and the longest run L (1,..., 60) in a series of n=60 independent Bernoulli observations for success probability 0.6. The probabilities are stored in the "times" representations, multiplied by 2 60 1. Only the joint distributions for n=15, 60, 100 and success probabilities 0.5 and 0.6 are included in the package to avoid excessive storage, but many more cases are generated in the script crossrun1.r. joint60.6 matrix, 60 rows and 60 columns generated by the function crossrunbin and transformed from an Rmpfr array to a matrix joint60symm Joint probabilities, n=60, symmetric case The joint probabilities of the number C og crossings (0,... 59) and the longest run L (1,..., 60) in a series of n=60 independent Bernoulli observations for the symmetric case (success probability 0.5). The probabilities are stored in the "times" representations, multiplied by 2 60 1 and are integers in the symmetric case. Only the joint distributions for n=15, 60, 100 and success probabilities 0.5 and 0.6 are included in the package to avoid excessive storage, but many more cases are generated in the script crossrun1.r. joint60symm

simclbin 11 Format matrix, 60 rows and 60 columns Source generated by the function crossrunsymm and transformed from an Rmpfr array to a matrix simclbin Simulation of Independent Bernoulli Observations Simulation of a sequence of independent Bernoulli Observations. To reduce the amount of random draws, each simulation is based on a sequence of standard normal variables, and whether each observation is above a shift defined by the binomial probabilities assumed. simclbin(nser = 100, nsim = 1e+05, probs = c(0.5, 0.6, 0.7, 0.8, 0.9)) nser nsim probs length of sequence simulated number of simulations binomial probabilites a data frame with the number of crossings and longest run for each probability. For instance the variables nc0.5 and lr0.5 are the number of crossings and the longest run for success probability 0.5. One row for each simulation. cl30simbin <- simclbin(nser=30, nsim=100) mean(cl30simbin$nc0.5) # mean number of crossings, p=0.5 mean(cl30simbin$lr0.9) # mean longest run, p=0.9

Index Topic datasets joint100.6, 8 joint100symm, 8 joint15.6, 9 joint15symm, 9 joint60.6, 10 joint60symm, 10 boxprobt, 2 clshift, 3 crossrunbin, 3 crossrunchange, 4 crossrunshift, 5 crossrunsymm, 5 cumsumm, 6 cumsummcol, 7 exactbin, 7 joint100.6, 8 joint100symm, 8 joint15.6, 9 joint15symm, 9 joint60.6, 10 joint60symm, 10 simclbin, 11 12