Skip to content

Instantly share code, notes, and snippets.

@abikoushi
Created March 28, 2026 00:03
Show Gist options
  • Select an option

  • Save abikoushi/573bfeea9ec2a3c4dbf817e987b85f98 to your computer and use it in GitHub Desktop.

Select an option

Save abikoushi/573bfeea9ec2a3c4dbf817e987b85f98 to your computer and use it in GitHub Desktop.
逆関数法の例
set.seed(1234)
u <- runif(10000)
X1 <- qweibull(u, 2, 2, lower.tail = TRUE)
X2 <- qweibull(u, 2, 2, lower.tail = FALSE)
png("inversefunction_method.png", width =800, height=500)
par(mfrow=c(1,2))
plot(ecdf(X1))
curve(pweibull(x,2,2), add=TRUE, col="orangered")
plot(ecdf(X2))
curve(pweibull(x,2,2), add=TRUE, col="orangered")
dev.off()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment