LoginSignup
0
0

ベイズ統計モデリング 4_5

Last updated at Posted at 2024-01-14

正規分布のグラフ

# Graph of normal probability density function, with comb of intervals.
meanval = 162              # Specify mean of distribution.
sdval = 15                 # Specify standard deviation of distribution.
xlow  = meanval - 3.5*sdval # Specify low end of x-axis.
xhigh = meanval + 3.5*sdval # Specify high end of x-axis.
dx = sdval/10               # Specify interval width on x-axis
# Specify comb of points along the x axis:
x = seq( from = xlow , to = xhigh , by = dx )
# Compute y values, i.e., probability density at each value of x:
y = ( 1/(sdval*sqrt(2*pi)) ) * exp( -.5 * ((x-meanval)/sdval)^2 )
# Plot the function. "plot" draws the intervals. "lines" draws the bell curve.
df = data.frame(x,y)
g = ggplot() + geom_line(data=df, mapping=aes(x=x, y=y))
print(g)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0