Commit 3b204ce0 authored by Reinhard Furrer's avatar Reinhard Furrer

some changes

parent 9f8b0952
prsim <- function(data, station_id="Qobs", number_sim=1, win_h_length=15, marginal="kappa",
verbose=TRUE, kappapar=TRUE, suppWarn=FALSE, KStest=FALSE){
prsim <- function(data, station_id="Qobs", number_sim=1, win_h_length=15,
marginal=c("kappa","empirical","CDF.fit"), draw="rCDF",
verbose=TRUE, marginalpar=TRUE, suppWarn=FALSE, KStest=FALSE, ...){
ifft <- function (x) fft(x, inverse = TRUE)/length(x)
......@@ -21,14 +22,13 @@ prsim <- function(data, station_id="Qobs", number_sim=1, win_h_length=15, margin
DD=as.integer(format(data[,1],'%d')),
Qobs=data[,station_id],
timestamp=data[,1])
}else {
if(!all(c("YYYY","MM","DD") %in% colnames(data))) stop("Wrong time column names")
} else {
if(!all(c("YYYY","MM","DD") %in% colnames(data))) stop("Wrong time column names")
data <- data[,c("YYYY","MM","DD", station_id)]
tmp <- paste(data$YYYY,data$MM,data$DD,sep=" ")
names(data) <- c("YYYY","MM","DD","Qobs")
data$timestamp <- as.POSIXct(strptime(tmp, format="%Y %m %d", tz="GMT"))
data <- data[,c("YYYY","MM","DD", station_id)]
tmp <- paste(data$YYYY,data$MM,data$DD,sep=" ")
names(data) <- c("YYYY","MM","DD","Qobs")
data$timestamp <- as.POSIXct(strptime(tmp, format="%Y %m %d", tz="GMT"))
}
......@@ -314,10 +314,10 @@ prsim <- function(data, station_id="Qobs", number_sim=1, win_h_length=15, margin
}
if(marginal=="kappa"){
if (kappapar) { # also return intermediate results
return(list( simulation=data_stoch, kappa_pars=kap_par_day, p_val=p_vals))
if (marginalpar) { # also return intermediate results
return(list( simulation=data_stoch, pars=kap_par_day, p_val=p_vals))
} else {
return(list( simulation=data_stoch, kappa_pars=NULL, p_val=p_vals))
return(list( simulation=data_stoch, pars=NULL, p_val=p_vals))
}
}else{
return(list( simulation=data_stoch) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment