Displaying 20 results from an estimated 300 matches similar to: "a small question about R with Winbugs"
2013 Jun 24
0
Running MCMC using R2WinBUGS
Hi All:
Not sure why my previous question never got posted. Here I am seeking some
help on my code. I am using the following code to run MCMC simulation on
the following data using the model below:
# Data
matrix<-NULL
> csvs<-paste("MVN", 1:2,".csv",sep="")
> for (i in 1:length(csvs)){
+ matrix[[i]]<- read.csv(file=csvs[i],header=TRUE)
+
2011 Jun 23
0
Fwd: Re: Help with winbugs code
Hi folks,
I'm forwarding this to the list as my email to nita was about getting
her code to the list. Additionally, I'm running Linux and have no
experience with WinBUGS.
Jim
-------- Original Message --------
Subject: Re: [R] Help with winbugs code
Date: Thu, 23 Jun 2011 16:49:33 +0700
From: nita yalina <tayalin at gmail.com>
To: Jim Lemon <jim at bitwrit.com.au>
2010 Apr 09
0
rjags syntax error
Hi, I am getting the following error when I'm running jags.model()
> meas1 <- jags.model(file="measurement.bug",data=dat.test)
syntax error, unexpected '}', expecting ',' or ')'
Error in jags.model(file = "measurement.bug", data = dat.test) :
Parse error on line 1
Below is my JAGS model. Please cc me as I'm a digest subscriber if
2012 Aug 13
0
rjags error. Error parsing model file:,syntax error on line 5 near ""
Greetings, I am running a factor analysis model in rjags and have
received the following error
Error parsing model file: syntax error on line 5 near ""
Line 5 is model {
Here is my syntax. Any insight would be greatly appreciated.
require(rjags)
modelstring = "
model {
for (i in 1 : nData) {
for (j in 1 : nIndicators) {
y[i,j] ~ dnorm(mu[i,j],psi[j])
ephat[i,j] <-
2009 Jun 04
1
Using WinBUGS from R: A Multi-Way Array Problem
Please suggest a way out to the following problem.
I have a T by n data matrix (say Y) where coulmns are time series of length
T.
To do some analysis in WinBUGS I need to construct my data as follows.
yy<-rep(Y,k) ## this will be a vector
Yk<-array(yy,dim=c(T,n,k)) ## data array
Here the definition of dim indices is
first index: T rows
second index: n columns
third index: for kth T by n
2006 Oct 09
1
winbugs - R question
hi all
i would like to use r and winbugs in order to undertake seemingly unrelated regression. i am using the R2WINBUGS library. i just simulated a simple example (sample size is 25) in order to get the correct code.
i suspect that the problem is in my definition of the prior. it wants a multivariate node.
the example could be extended by including more than 1 X variable in the system of
2012 Jul 09
1
R to winbugs interface
Hello everyone,
I need some help regarding calling WinBUGS from R. I
have a model for WinBUGS and an R code which calls WinBUGS. On running the
code I am being shown the error message :
Error in file(con, "wb") : cannot open the connection
In addition: Warning messages:
1: In file.create(to[okay]) :
cannot create file 'c:/Program
2007 Jul 21
1
Gamma MLE
Hello,
I was asked to try the following code on R,
gamma.mles
function (xx,shape0,rate0)
{
n<- length(xx)
xbar<- mean(xx)
logxbar<- mean(log(xx))
theta<-c(shape0,rate0)
repeat {
theta0<- theta
shape<- theta0[1]
rate<- theta0[2]
S<- n*matrix(c(log(rate)-digamma(shape)+logxbar,shape/rate-xbar),ncol=1)
I<- n*matrix(c(trigamma(shape),-1/rate,-1/rate,shape/rate^2),ncol=2)
2011 Feb 21
0
Function within functions and MLE
Hi,
I am trying to determine the MLE of the following function:
http://r.789695.n4.nabble.com/file/n3317341/untitled.bmp
I have defined both parts of the equation as separate functions and looped
over the t and G values to get summations of each part.
The lamda function has 3 unknowns which I am trying to determine using MLE
bub tin order to try and get the overall function working these
2010 Apr 12
1
Strange results from Multivariate Normal Density
Hello,
I'm using dmnorm from the package {mnormt} and getting strange results.
First, according to the documentation, dmnorm should return a vector of
densities, and I'm only getting one value returned (which is what I would
expect). I've been interpreting this as the joint density of all values in
the x vector (which is what I want). Should a vector of densities be
returned, and if
2011 Jun 18
2
different results from nls in 2.10.1 and 2.11.1
Hi,
I've noticed I get different results fitting a function to some data on
my laptop to when I do it on my computer at work.
Here's a code snippet of what I do:
##------------------------------------------------------------------
require(circular) ## for Bessel function I.0
## Data:
dd <- c(0.9975948929787, 0.9093316197395, 0.7838819026947,
0.9096108675003, 0.8901804089546,
2013 Apr 08
0
Maximum likelihood estimation of ARMA(1,1)-GARCH(1,1)
Hello
Following some standard textbooks on ARMA(1,1)-GARCH(1,1) (e.g. Ruey
Tsay's Analysis of Financial Time Series), I try to write an R program
to estimate the key parameters of an ARMA(1,1)-GARCH(1,1) model for
Intel's stock returns. For some random reason, I cannot decipher what
is wrong with my R program. The R package fGarch already gives me the
answer, but my customized function
2006 Nov 11
2
Bayesian question (problem using adapt)
In the following code I have created the posterior density for a Bayesian
survival model with four parameters. However, when I try to use the adapt
function to perform integration in four dimensions (on my old version of R
I get an error message saying that I have applied a non-function, although
the function does work when I type kernel2(param0, theta0), or on the
newer version of R the computer
2011 Aug 13
3
optimization problems
Dear R users
I am trying to use OPTIMX(OPTIM) for nonlinear optimization.
There is no error in my code but the results are so weird (see below).
When I ran via OPTIM, the results are that
Initial values are that theta0 = 0.6 1.6 0.6 1.6 0.7. (In fact true vales
are 0.5,1.0,0.8,1.2, 0.6.)
--------------------------------------------------------------------------------------------
>
2004 Feb 16
0
error in nls, step factor reduced below minFactor
Hello,
I am trying to estimate 4 parameters of a non-linear
model using nls.
My model function is a Fourier integral and is very
expensive to
calculate. I get the following error:
> theta0 <- c(0.045, 1.02*10^(-4), 0.00169,
5.67*10^(-4))
> res <- nls(log(y) ~ log(model(theta,r,t)),
data=dataModel,
+ start=list(theta=theta0), trace=TRUE,
+ control=nls.control(tol=1e-2))
2011 Aug 29
0
Error: Gradient function might be wrong ----- in OPTIMX
Dear R users
When I use OPTIMX with BFGS, I've got the following error message.
-----------------------------------------------------------------
> optimx(par=theta0, fn=obj.fy, gr=gr.fy, method="BFGS")
Error: Gradient function might be wrong - check it!
-----------------------------------------------------------------
So, I checked and checked my gradient function line by
2008 Mar 19
1
problem with optim and integrate
Dear all,
I want to min "integrate( (p1*dnorm+p2*dnorm+p3*dnorm)^(1.3))" for p, mu,
and sigma.
So, I have to estimate 8 parameters(p3=1-p1-p2).
I got this warning-"Error in integrate(numint, lower = -Inf, upper = Inf) :
non-finite function value."
My questions are
How could I fix it? I tried to divide into several intervals and sum up, but
I got same message.
My code is
2011 Feb 22
2
mle
Hi,
I am looking for some help regarding the use of the mle function.
I am trying to get mle for 3 parameters (theta0, theta1 and theta2) that
have been defined in the the log-likelihood equation as theta0=theta[1],
theta1=theta[2] and theta2=theta[3].
My R code for mle is:
mle(Poisson.lik, start=list(theta=c(20,1,1), method="Nelder-Mead",
fixed=list(w=w, t1=t1, t2=t2))
But I keep
2010 Jul 20
0
Maximum likelihood estimation in R
Dear R-helper,
I am trying to do maximum likelihood estimation in R. I use the "optim" function. Since I have no prior information on the true values of the parameters, I just randomly select different sets of starting values to feed into the program. Each time, I get the following error message: Error in optim(theta0, lf, method = "BFGS", hessian = T, Y = Y, X = X, :
2023 Aug 20
1
Issues when trying to fit a nonlinear regression model
Oh, sorry; I changed signs in the model, fitting
theta0 + theta1*exp(theta2*x)
So for theta0 - theta1*exp(-theta2*x) use theta1= -.exp(-1.8) and theta2 =
+.055 as starting values.
-- Bert
On Sun, Aug 20, 2023 at 11:50?AM Paul Bernal <paulbernal07 at gmail.com> wrote:
> Dear Bert,
>
> Thank you so much for your kind and valuable feedback. I tried finding the
> starting