Displaying 2 results from an estimated 2 matches for "bpllkd".
Did you mean:
billk
2003 Jul 09
2
A problem with using the "outer" function
..." to
work on one of my functions. Here is a simple example illustrating my
problem:
> b1 <- c(1.2,2.3)
> b2 <- c(0.5,0.6)
> x <- c(3e+01, 1e+02, 3e+02, 5e+02, 1e+03, 1e+04, 1e+05, 1e+06)
> y <- c(2,4,2,5,2,3,1,1)
> n <- c(5,8,3,6,2,3,1,1)
> outer(b1,b2,FUN=bpllkd,x,y,n)
[,1] [,2]
[1,] 17.78031 17.78031
[2,] 17.78031 17.78031
These values should all be different. What is the problem here?
The function "bpllkd" is given below:
thanks for any help,
Ravi.
> bpllkd
function(t1,t2,x,y,n){
p <- 1 - (1+x/10^t1)^(-t2)
keep <- !((p...
2002 Nov 25
3
How top print intermediate values from inside a function?
...e, how do I
get it to print the intermediate variable "mh.new" for each simulation,
when I call the function "MHsim.ind"?
thanks for any help,
Ravi.
####################################################################
MHsim.ind <- function(nsim=1000,start=0,spread=1,likfn=bpllkd){
# Independence Metropolis algorithm with candidate density a
#multivariate Student t-distribution with 1 degree of freedom, whose
#mean and variance are taken to be MLE and its covariance matrix
mh.0 <- start
npar <- length(start)
mh.sim <- matrix(0,nrow=nsim,ncol=npar)
i <- 0
whi...