R EVMIX convert pdf to uniform marginals -
i'm trying convert distribution pseudo-uniform distribution. using spd r package, easy , works expected.
library(spd) x <- c(rnorm(100,-1,0.7),rnorm(100,3,1)) fit<-spdfit(x,upper=0.9,lower=0.1,tailfit="gpd", kernelfit="epanech") uniformx = pspd(x,fit)
i want generalize extreme value modeling include threshold uncertainity. used evmix package.
library(evmix) x <- c(rnorm(100,-1,0.7),rnorm(100,3,1)) fit = fgkg(x, phiul = false, phiur = false, std.err = false) pgkg(x,fit$lambda, fit$ul, fit$sigmaul, fit$xil, fit$phiul, fit$ur, fit$sigmaur, fit$xir, fit$phiur)
im messing somewhere.
please check out pgkg function:
help(pgkg)
which gives syntax:
pgkg(q, kerncentres, lambda = null, ul = as.vector(quantile(kerncentres, 0.1)), sigmaul = sqrt(6 * var(kerncentres))/pi, xil = 0, phiul = true, ur = as.vector(quantile(kerncentres, 0.9)), sigmaur = sqrt(6 * var(kerncentres))/pi, xir = 0, phiur = true, bw = null, kernel = "gaussian", lower.tail = true)
you have missed kernel centres (the data), needed kernel density estimators. here corrected code:
library(evmix) x <- c(rnorm(100,-1,0.7),rnorm(100,3,1)) fit = fgkg(x, phiul = false, phiur = false, std.err = false) prob = pgkg(x, x, fit$lambda, fit$ul, fit$sigmaul, fit$xil, fit$phiul, fit$ur, fit$sigmaur, fit$xir, fit$phiur) hist(prob) % uniform expected
Comments
Post a Comment