Learn R Programming

FVDDPpkg (version 0.1.2)

update: Update the FVDDP when new observations are collected

Description

Update the FVDDP when new observations are collected

Usage

update(fvddp, y.new)

Value

An object which is similar to the one given as an input. In particular, the multiplicities of y.new will be added to each row of M, and the weights w will be multiplied times the probability of drawing y.new form each row of the matrix M according to Polya urn sampling scheme.

Arguments

fvddp

An object of class fvddp; it can be created via initialize().

y.new

A vector of new values to update the process.

References

PapaspiliopoulosRuggieroSpanò2016FVDDPpkg

Examples

Run this code
#initialize and propagate a object
FVDDP = initialize(1, function(x) rpois(x, 3),
                   function(x) dpois(x, 3), TRUE)
update(fvddp = FVDDP, y.new = c(4,5))

#in this case, update after a propagation to see the diiffent effect of polya urn on the weights
FVDDP=initialize(3, function(x) rnorm(x, -1,3),
                 function(x) dnorm(x, -1, 3), FALSE)
FVDDP = update(FVDDP, c(-1.145, 0.553, 0.553))
FVDDP = propagate(FVDDP, 0.6)
update(fvddp = FVDDP, y.new = c(0.553, -0.316, -1.145))

Run the code above in your browser using DataLab