rain: Rain simulation

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Rain simulation calculations by Marked Poisson process and Markov processes

Usage

1
2
3
poisson.rain(rate=1, ndays=30, shape=1, scale=1, plot.out=T)
semimarkov.rain(P, Hk, Ha, tsim)
semimarkov(P, Hk, Ha, tsim, xinit)

Arguments

rate

parameter: rate of exponential

ndays

number of days to simulate

shape

parameter: shape of weibull

scale

parameter: scale of weibull

plot.out

logical variable to decide whether to plot

Ha

rates of holding times

Hk

order of holding times

tsim

simulation time

P

Markov matrix

xinit

intial state

Details

Simulate rainfall for every day of a month. A rainy or wet day is decided upon a Poisson process, and the mark would the amount of rain for that day if it is a wet day. The frequency distribution of rainfall in rainy days at a site determine the amount of rain, once a day is selected as wet. Daily rainfall distribution is skewed towards low values and it varies month to month according to climatic records. We generate rainfall amount using the Weibull distribution. Function semimarkov simulates semi-Markov dynamics assuming Erlang densities for the holding times. It uses five arguments: the first three are the matrices and then the simulation time and initial state. It returns the state transitions, the holding times, and the simulation time.

Value

y

days in between rainy days, cumulative inter-event times, and amount of rain

z

amount of rain in a day, matrix

x

rainy day sequence

tau

days in between rainy days

t

time

Note

Input files are in 'datafiles.zip' in directory 'datafiles' and organized by chapters of Acevedo (2013a,b).

Author(s)

Miguel F. Acevedo Acevedo@unt.edu

References

Acevedo M.F. 2013a. "Simulation of Ecological and Environmental Models". CRC Press. Acevedo M.F. 2013b. "Data Analysis and Statistics for Geography, Environmental Science, and Engineering", CRC Press.

See Also

Weather functions of SEEM rain.day, markov.rain.seq, markov.rain,

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#marked poisson simulation 
ndays= 30;rate=0.5;shape=0.7; scale=0.4
# define array
zp <- array()
rainy <- poisson.rain(rate,ndays,shape,scale,plot.out=FALSE)
zp <- rainy$z[,2]; nwet <- length(rainy$y[,3])

P <- matrix(c(0.4,0.2,0.6,0.8), ncol=2, byrow=TRUE)
Ha <- matrix(c(1,1,1,1), ncol=2, byrow=TRUE)
ndays=365
# exponential
Hk <- matrix(c(1,1,1,1), ncol=2, byrow=TRUE)
# erlang 2
Hk <- matrix(c(1,3,3,1), ncol=2, byrow=TRUE)
y <- semimarkov.rain(P, Hk, Ha, ndays)
hist(y$tau)

# semimarkov
P <- matrix(c(0.5,0.4,0.0,0.0, 0.0,0.0,0.9,0.5, 0.5,0.6,0.0,0.0, 0.0,0.0,0.1,0.5), ncol=4, byrow=TRUE)
Ha <- matrix(c(0.025,0.0154,0.0,0.0, 0.0,0.0,0.04,0.02, 0.025,0.0154,0.0,0.0, 0.0,0.0,0.04,0.02), ncol=4, byrow=TRUE)
Hk <- matrix(c(2,2,0.0,0.0, 0.0,0.0,2,2, 2,2,0.0,0.0, 0.0,0.0,2,2), ncol=4, byrow=TRUE)
nruns=4; y <- list()
for(i in 1:nruns)
y[[i]] <- semimarkov(P, Hk,Ha, tsim=1000, xinit=3)

## Not run: 
panel4(size=7)
for(i in 1:nruns)
plot(y[[i]]$t,y[[i]]$x,type="s",xlab="Years",ylab="State (Role)",ylim=c(1,4))

for(i in 1:nruns)
hist(y[[i]]$tau,xlab="Years",main="Hist of Holding time",cex.main=0.7)

## End(Not run)

seeg documentation built on May 30, 2017, 7:09 a.m.