-1

私は次のように R(ソフトウェア) を使用してベータ ガンベル分布をプロットしようとしています。ジャンル的な考え方は、ベータ分布の pdf では、x をプラグインする代わりに、代わりにガンベルの cdf を使用することです。しかし、適切なプロットを取得できませんでした。

x <- seq(-3, 3, length=100)
Fx = pgumbel(x,loc=0,scale=1)
y = dbeta(Fx,shape1=0.5,shape2=0.5)
plot(x, y, type="l", lty=2, xlab="x value", ylab="Density",ylim=c(0,1))
4

1 に答える 1

3

I don't believe you when you say that you didn't use any add-on packages: pgumbel() is not in base R. library("sos"); findFn("pgumbel") finds it in a variety of places, I used the evd package.

There are a couple of small issues here.

library("evd")

The main thing is that you want length=100 rather than by=100 (which gives you a single-element x vector):

x <- seq(-3, 3, length=100)

The actual computations are OK:

Fx = pgumbel(x,loc=0,scale=1)
y = dbeta(Fx,shape1=0.5,shape2=0.5)

You need to change ylim to be able to see what's going on. However, I also think you need to do something to account for the differential dx in order to get a proper density function (that's more of a StackExchange than a StackOverflow question though).

par(las=1,bty="l")  ## my personal preferences
plot(x, y, type="l", lty=2, xlab="x value", ylab="Density",ylim=c(0,40))
于 2013-05-25T01:58:35.000 に答える