## one data stream, mixture of two normals
x = c(rnorm(100, 0, 1), rnorm(100, 5, 1))
dens = smoothdens(x, par = list(mean = c(0, 5), sd = c(1, 1)))
Z = dens$Z # design matrix
S = dens$S # penalty matrix
beta = dens$coef # initial coefficients
allprobs = dens$density(beta) # use this in the likelihood function
## 3 data streams
data = data.frame(x1 = rnorm(100, mean = 0, sd = 1),
x2 = rgamma2(100, mean = 5, sd = 3),
x3 = rvm(100, mu = 0, kappa = 2))
par = list(x1 = list(mean = 0, sd = 1),
x2 = list(mean = 5, sd = 3),
x3 = list(mean = 0, kappa = 2))
dens = smoothdens(data, par, type = c("real", "positive", "circular"))
# objects for x1
Z1 = dens$x1$Z
allprobs = dens$x1$density(dens$x1$coef) *
dens$x2$density(dens$x2$coef) *
dens$x3$density(dens$x3$coef)
Run the code above in your browser using DataLab