Displaying 20 results from an estimated 10000 matches similar to: "solving system of nonlinear equations"
2009 Jul 17
6
Solving two nonlinear equations with two knowns
Dear R users,
I have two nonlinear equations, f1(x1,x2)=0 and f2(x1,x2)=0. I try to use optim command by minimize f1^2+f2^2 to find x1 and x2. I found the optimal solution changes when I change initial values. How to solve this?
BTW, I also try to use grid searching. But I have no information on ranges of x1 and x2, respectively.
Any suggestion to solve this question?
Thanks,
Kate
2004 Feb 29
1
LCG with modulo 2^30
I can't run a function which generates random numbrers using linear
congruential generator. My multiplier is a=5+8^6, increment is b=1 and
modulo is m=2^30.
the code I have written works for modulo upto m=2^28.
For m= 2^29 , it says, can not allocate memory for the vector or something
like that.
For m= 2^31 or more, its says the argument "for i in 1:m " is too large in
2008 Jul 23
1
R2WinBUGS problem
Dear friends - I'm on winXP, R 2.71 - I have with some help dveloped
this multivariate normal model, which gives very plausible results in
WinBUGS even without any
initial values specified. However, when I then try to run the same model
via the bugs function in R2WinBUGS with inits specified as inits=NULL
the program stops in a dead end. So I have tried to make inits for the
bugs function
2005 Jan 25
1
CODA vs. BOA discrepancy
Dear List:
the CODA and BOA packages for the analysis of MCMC output yield different
results on two dignostic test of convergence: 1) Geweke's convergence
diagnostic; 2) Heidelberger and Welch's convergence diagnostic. Does that
imply that the CODA and BOA packages implement different ``flavors'' of
the same test?
I paste below an example.
Geweke's test
2010 Jun 23
1
A question about R2Winbugs
Dear R users:
I was trying to fit a HMM with mixture of Gaussian into the dataset, and I
tried to implement it by R2Winbugs. But I got the following errer.
*
Error in FUN(X[[1L]], ...) :
.C(..): 'type' must be "real" for this format*
Does anybody know what's the problem? Does R2Winbugs accept some matrix as
inits? I would really appreciate your help. Thank you very much.
2009 Jul 16
1
Error with r2winbugs
Hi,
I am trying to do run the following model saved in "C:/bugs/sus.bug"
model {
for (i in 1:n){
y[i] ~ dpois(lamdba[i])
log(lambda[i]) <- mu+bmale[male[i]]+bschn[schn[i]]+epsilon[i] #
epsilon[i] ~ dnorm(0,tau.epsilon)
}
mu ~ dnorm(0,.0001)
bmale ~ dnorm(0,.0001)
tau.epsilon <- pow(sigma.epsilon, -2)
sigma.epsilon ~ dunif(0,100)
for (j in
2006 Dec 09
1
WinBUGS14 and R
I'm trying to call BUGS from R. But it's not working. R freezes up and
BUGS gives me a strange output in the log. Just to know, BUGS is
registered. The modified date on the keys file is today (Dec. 9th). It
should be fully registered so that I can use it fully. And, the BUGS model
is syntactically correct. Any suggestions would be very helpful.
Here is my BUGS model:
model {
2006 Apr 27
1
State space AR models in R: some examples
Hi all,
Does anyone have an example of an autoregressive (AR) time-series model
specified as a state space model in R? That is, I want to go beyond the
locally linear (constant) model, and fit the following Gaussian AR state
process model:
Xt = a + (1+b)*Xt-1 + epsilon
,where the model for the observation process is
Yt = Xt + tau
I have information of the tau's (observation variance)
2009 Aug 19
1
BUGS
I am running a BUGS function with following
schools.sim <-bugs(data,inits,
parameters,
model.file="schools.txt",
n.chains=3,
n.iter=1000,
bugs.directory="E:/Rprograms")
My model.file IS in the directory
2008 Dec 15
3
R2winbugs : vectorization
I'm new to bugs, so please bear with me. Can someone tell me if the
following two models are doing the same thing? The reason I ask is
that with the same data, the first (based on 4 separate coeffs
a1--a4) takes about 50 secs, while the second (based on a vectorized
form, a[]) takes about 300. The means are about the same, though
R-hat's in the second version are quite a bit better.
2012 Mar 08
1
sas retain statement in R or fitting differene equations in NLS
I wish to fit a dynamical model in R and I am running in a problem that
requires some of your wisdom to solve. For SAS users I am searching for
the equivalent of the */retain/ *statement.
For people that want to read complicated explanations to help me:
I have a system of two equations written as difference equations here.
To boil it down. I have a dataframe with three variables y, X1, X2
2009 Dec 03
2
Help R2WinBUGS
Hello,
I have problem running WinBUGS from R.
The following example works in WinBUGS but it does not work in R through
package R2WinBUGS.
Does anyone know what the problem is?
x <- c(0.2, 1.1, 1, 2.2, 2.5, 2.9, 2.9, 3.6, 3.8, 0.6, 1, 2, 2.4, 2.6, 2.8,
3.2, 3.9, 3.5)
y <- c(0.5, 1.3, 0.1, 0.7, -0.4, 0.5, -0.9, -0.3, -0.3, 0.6, 0.4, 0.9, -0.1,
-0.4, -0.5, -0.2, 0.3, -1.5)
eco <- c(1, 3,
2012 Oct 26
1
Openbugs- Array Index
Hi,
I'm working on the codes below however every time I run them when they get
to OpenBUGS I keep getting the error message: array index is greater than
array upper bound for hab.
Any help would be greatly appreciated,
Suzie
Codes:
ungulate <- read.csv(file.choose ()) #ungulate
ungulate <-
as.matrix(ungulate);colnames(ungulate)<-NULL;rownames(ungulate)<-NULL
2006 Apr 05
2
R2WinBUGS error
Dear R-help,
I'm using the R2WinBUGS package and getting an error message:
Error in file(file, "r") : unable to open connection
In addition: Warning message:
cannot open file 'codaIndex.txt', reason 'No such file or
directory'
I'm using R 2.2.1 and WinBUGS 1.4.1 on a windows machine (XP). My R code
and WinBUGS code is given below.
2010 Aug 16
1
Specify decimal places for parameters in BUGS output
Hi All:
I had a basic question to ask. I am running R2WinBUGS so that I could
automate the running of my model using 1000 simulated datasets. Below is the
code I am using. The only problem I am having is the bugs output that comes
out shows my parameters as nos with 1 decimal place after. I would want to
have the parameters with 5 places after decimal. How would I specify that in
my code for
2008 Nov 01
2
sampling from Laplace-Normal
Hi,
I have to draw samples from an asymmetric-Laplace-Normal distribution:
f(u|y, x, beta, phi, sigma, tau) \propto exp( - sum( ( abs(lo) +
(2*tau-1)*lo )/(2*sigma) ) - 0.5/phi*u^2), where lo = (y - x*beta) and
y=(y_1, ..., y_n), x=(x_1, ..., x_n)
-- sorry for this huge formula --
A WinBUGS Gibbs sampler and the HI package arms sampler were used with the
same initial data for all parameters. I
2012 Oct 25
2
How to extract auc, specificity and sensitivity
I am running my code in a loop and it does not work but when I run it
outside the loop I get the values I want.
n <- 1000; # Sample size
fitglm <- function(sigma,tau){
x <- rnorm(n,0,sigma)
intercept <- 0
beta <- 0
ystar <- intercept+beta*x
z <- rbinom(n,1,plogis(ystar))
xerr <- x + rnorm(n,0,tau)
model<-glm(z ~ xerr, family=binomial(logit))
2008 Feb 19
1
repeated measures ANOVA using a cov matrix
Dear all,
how can I perform a repeated measures ANOVA using a covariance matrix as input?
E.g., I have four repeated measures (N = 200) with mean vector tau (no
BS factor):
tau <- rbind(1.10, 2.51, 2.76, 3.52)
and covariance matrix (sigma):
sigma <- matrix(c(0.523, 0.268, 0.267, 0.211,
0.268, 0.444, 0.492, 0.571,
0.267, 0.492, 1.213,
2010 Apr 29
1
a question on autocorrelation acf
Hi R users,
where can I find the equations used by acf function to calculate
autocorrelation? I think I misunderstand acf. Doesn't acf use following
equation to calculate autocorrelation?
[image: R(\tau) = \frac{\operatorname{E}[(X_t - \mu)(X_{t+\tau} -
\mu)]}{\sigma^2}\, ,]
If it does, then the autocorrelation of a sine function should give a
cosine; however, the following code gives a
2009 Aug 17
1
Bayesian data analysis - help with sampler function
I have downloaded the Umacs (Universal Markov chain sampler) and submitted the following sample code from Kerman and Gelman.
s <-Sampler(
J=8,
sigma.y =c(15,10,16,11,9,11,10,18),
y =c(28, 8,-3,7,-1,1,18,12),
theta =Gibbs(theta.update,theta.init),
V =Gibbs(V.update,mu.init),
mu =Gibbs(mu.update,mu.init),
tau =Gibbs(tau.update,tau.init),