如何生成包含0和1的不同曲率的曲线?

问题描述 投票:-1回答:2

我知道这是统计上的问题,而不是编程上的问题,但是如果可能的话,我想在R中找到一个解决方案。我如何生成一组连接0和1的不同曲率的凹凸曲线,如下例所示:

enter image description here

r distribution curve
2个回答
0
投票

它们看起来像x的幂。 1:1线上方的那些是幂<1,而上方的那些是幂>1。因此,您希望y = x ^ n,其中n>0。也可以使用其他曲线系列。

x <- seq(0, 1, 0.01)
ns <- c(0.1,0.11,0.13,0.15,0.17,0.2,0.25,0.33,0.5,1,2,3,4,5,6,7,8,9,10)
plot(x, x, type = "l")
for (n in ns){
    lines(x, x^n)
}

“”

reprex package(v0.3.0)在2019-11-19创建


0
投票

您可以pbeta绘制不同形状参数的beta分布的CDF

shape1 <- c(4, 3, 2, 1, 1, 1, 1)
shape2 <- c(1, 1, 1, 1, 2, 3, 4)
x <- seq(0, 1, length.out = 100)

library(tidyverse)
map2_dfc(shape1, shape2,
    ~pbeta(x, .x, .y)) %>%
    bind_cols(x = x) %>%
    gather(key, y, -x) %>%
    ggplot(aes(x, y, group = key)) +
    geom_line()

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.