【发布时间】:2017-09-27 01:53:36
【问题描述】:
我有一个 R 图,我想在其中显示 IF “red”curve(现在位于图没有正确显示)被乘以一个常数,它可以匹配“蓝色”曲线 正在展示中。
我想知道如何最好地放大 “红色”曲线,使其完全匹配“蓝色”曲线?
(我的R代码在图片下方。)
这是我的 R 代码:
SIGMA = 2 # Population SIGMA known
observations = seq(1, 30) # observations drawn
n = length(observations) # number of observations
x_bar = mean(observations) # mean of observations
SE = SIGMA / sqrt(n) # 'S'tandard 'E'rror of the mean
x.min = x_bar - 4*SE
x.max = x_bar + 4*SE
Like = function(x) sapply(lapply(x, dnorm, x = observations, SIGMA), prod) # multiplication of densities to obtain Likelihood values
curve(dnorm(x, x_bar, SE), from = x.min, to = x.max, col = 'blue', lwd = 3, lty = 2 ) # Sampling Distribution of x_bar
curve(Like, from = x.min, to = x.max, col = 'red', lwd = 3, add = T) # Likelihood function of MU
【问题讨论】:
标签: r plot statistics distribution