Learn R Programming

RMAWGEN (version 1.3.9.3)

normalizeGaussian_severalstations: Converts several samples x random variable extracted by populations represented by the columns of data respectively or sample to a normally-distributed samples with assinged mean and standard deviation or vice versa in case inverse is TRUE

Description

Converts several samples x random variable extracted by populations represented by the columns of data respectively or sample to a normally-distributed samples with assinged mean and standard deviation or vice versa in case inverse is TRUE

Usage

normalizeGaussian_severalstations(
  x,
  data = x,
  cpf = NULL,
  mean = 0,
  sd = 1,
  inverse = FALSE,
  step = NULL,
  prec = 10^-4,
  type = 3,
  extremes = TRUE,
  sample = NULL,
  origin_x = NULL,
  origin_data = origin_x
)

Value

a matrix with the normalized variable or its inverse

Arguments

x

value to be converted

data

a sample of data on which a non-parametric probability distribution is estimated

cpf

cumulative probability distribution. If NULL (default) is calculated as ecdf(data)

mean

mean (expected value) of the normalized random variable. Default is 0.

sd

standard deviation of the normalized random variable. Default is 1.

inverse

logical value. If TRUE the function works inversely (the opposite way). Default is FALSE.

step

vector of values in which step discontinuities of the cumulative probability function occur. Default is NULL

prec

amplitude of the neighbourhood of the step discontinuities where cumulative probability function is treated as non-continuous.

type

see quantile

extremes

logical variable. If TRUE (default) the probability or frequency is multiplied by $$\frac{N}{N+1}$$ where \(N\) is the length of data

sample

information on how to sample x and data. Default is NULL, this means that the values of each column of x and data belong to the same sample. If x and data are sampled for each month seperately, it is set to monthly.

origin_x

date corresponding to the first row of x

origin_data

date corresponding to the first row of data

Author

Emanuele Cordano, Emanuele Eccel

See Also

normalizeGaussian

Examples

Run this code

if (FALSE) {
library(RMAWGEN)

set.seed(1234)
N <- 30
x <- rexp(N)
y <- x+rnorm(N)
df <- data.frame(x=x,y=y)

dfg <- normalizeGaussian_severalstations(df,data=df,extremes=TRUE,inverse=FALSE)

dfi <- normalizeGaussian_severalstations(dfg,data=df,extremes=TRUE,inverse=TRUE)

N <- 365*2
origin <- "1981-01-01"
x <- rexp(N)
y <- x+rnorm(N)
df <- data.frame(x=x,y=y)

dfgm <- normalizeGaussian_severalstations(df,data=df,extremes=TRUE,
inverse=FALSE,origin_x=origin,origin_data=origin,sample="monthly")

dfim <- normalizeGaussian_severalstations(dfg,data=df,extremes=TRUE,
inverse=TRUE,origin_x=origin,origin_data=origin,sample="monthly")


## Compatibility with 'lubridate' package


library(lubridate)


N <- 30
x <- rexp(N)
y <- x+rnorm(N)
df <- data.frame(x=x,y=y)

dfg <- normalizeGaussian_severalstations(df,data=df,extremes=TRUE,inverse=FALSE)

dfi <- normalizeGaussian_severalstations(dfg,data=df,extremes=TRUE,inverse=TRUE)

N <- 365*2
origin <- "1981-01-01"
x <- rexp(N)
y <- x+rnorm(N)
df <- data.frame(x=x,y=y)

dfgm <- normalizeGaussian_severalstations(df,data=df,extremes=TRUE,
inverse=FALSE,origin_x=origin,origin_data=origin,sample="monthly")

dfim <- normalizeGaussian_severalstations(dfg,data=df,extremes=TRUE,
inverse=TRUE,origin_x=origin,origin_data=origin,sample="monthly")
}




Run the code above in your browser using DataLab