Description Usage Arguments Examples
Find the posterior mean given the observations and the mixing distribution based on the family in the result
1 2 3 4 5 6 7 | posteriormean(x, result, fun = function(x) x)
posteriormean.npnorm(x, result, fun = function(x) x)
posteriormean.npt(x, result, fun = function(x) x)
posteriormean.npnormc(x, result, fun = function(x) x)
|
x |
a vector of observations |
result |
an object of class nspmix |
fun |
the function to transform the mean. It finds the posterior mean
of |
1 2 3 4 5 6 7 8 9 10 11 | data = rnorm(500, c(0, 2))
x = makeobject(data, pi0 = 0.5)
r1 = computemixdist(x)
posteriormean(data, r1)
x2 = makeobject(data, pi0 = 0.5, method = "nptll") # equivalent to normal
r2 = computemixdist(x2)
posteriormean(data, r2, fun = function(x) x^2)
data = runif(500, min = -0.5, max = 0.5)
x3 = makeobject(data, method = "npnormcll", beta = 100)
r3 = computemixdist(x3)
posteriormean(data, r3)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.