Displaying 20 results from an estimated 1000 matches similar to: "Solving two nonlinear equations with two knowns"
2010 Jul 18
2
loop troubles
Hi all, I appreciate the help this list has given me before. I have a
question which has been perplexing me. I have been working on doing a
Bayesian calculating inserting studies sequentially after using a
non-informative prior to get a meta-analysis type result. I created a
function using three iterations of this, my code is below. I insert prior
mean and precision (I add precision manually
2006 Sep 28
1
Nonlinear fitting - reparametrization help
Hi,
I am trying to fit a function of the form:
y = A0 + A1 * exp( -0.5* ( (X - Mu1) / Sigma1 )^2 ) - A2 * exp ( -0.5*
( (X-Mu2)/Sigma2 )^2 )
i.e. a mean term (A0) + a difference between two gaussians.
The constraints are A1,A2 >0, Sigma1,Sigma2>0, and usually Sigma2>Sigma1.
The plot looks like a "Mexican Hat".
I had trouble (poor fits) fitting this function to toy data
2005 Mar 23
4
sampling from a mixture distribution
Dear R users,
I would like to sample from a mixture distribution p1*f(x1)+p2*f(x2). I
usually sample variates from both distributions and weight them with their
respective probabilities, but someone told me that was wrong. What is the
correct way?
Vumani
2005 Jan 18
4
Data Simulation in R
Dear List:
A few weeks ago I posted some questions regarding data simulation and
received some very helpful comments, thank you. I have modified my code
accordingly and have made some progress.
However, I now am facing a new challenge along similar lines. I am
attempting to simulate 250 datasets and then run the data through a
linear model. I use rm() and gc() as I move along to clean up the
2007 Aug 29
3
OT: distribution of a pathological random variate
Folks,
I wonder if anything could be said about the distribution of a random variate x, where
x = N(0,1)/N(0,1)
Obviously x is pathological because it could be 0/0. If we exclude this point, so the set is {x/(0/0)}, does x have a well defined distribution? or does it exist a distribution that approximates x.
(The case could be generalized of course to N(mu1, sigma1)/N(mu2, sigma2) and one
2005 Jan 20
1
Windows Front end-crash error
Dear List:
First, many thanks to those who offered assistance while I constructed
code for the simulation. I think I now have code that resolves most of
the issues I encountered with memory.
While the code works perfectly for smallish datasets with small sample
sizes, it arouses a windows-based error with samples of 5,000 and 250
datasets. The error is a dialogue box with the following:
"R
2004 Sep 16
3
Estimating parameters for a bimodal distribution
For several years, I have been using Splus to analyze an ongoing series of
datasets that have a bimodal distribution. I have used the following
functions, in particular the ms() function, to estimate the parameters: two
means, two standard deviations, and one proportion. Here is the code I've
been using in S:
btmp.bi <- function(vec, p, m1, m2, sd1, sd2)
{
2005 Jan 08
2
Does R accumulate memory
Dear List:
I am running into a memory issue that I haven't noticed before. I am
running a simulation with all of the code used below. I have increased
my memory to 712mb and have a total of 1 gb on my machine.
What appears to be happening is I run a simulation where I create 1,000
datasets with a sample size of 100. I then run each dataset through a
gls and obtain some estimates.
This works
2000 Nov 14
3
2 plots 1 figure
How do you obtain two plots on the same figure?
for example
plot(rnorm(100)
plot(rnorm(100),type="l")
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To:
2013 Mar 30
1
normal mixture EM not working?
Hi,
I am currently working on fitting a mixture density to financial data.
I have the following data:
http://s000.tinyupload.com/?file_id=00083355432555420222
I want to fit a mixture density of two normal distributions.
I have the formula:
f(l)=πϕ(l;μ1,σ21)+(1−π)ϕ(l;μ2,σ22)
my R code is:
normalmix<-normalmixEM(dat,k=2,fast=TRUE)
pi<-normalmix$lambda[1]
mu1<-normalmix$mu[1]
2007 Oct 15
1
how to use normalmixEM to get correct result?
Dear R-Users,
I have a large number of data(54000) and the field of data is 50 to 2.0e9. I want to use normalmixEM (package:mixtools) to fit them in finite mixture narmal distributions,but get some mistakes.I don't know which steps make the error.
I have used the following functions before
>x<-read.table("data")
>log.x<-log10(x$V1)
>log.x<-sort(log.x)
2012 Sep 17
2
Problem with Stationary Bootstrap
Dear R experts,
I'm running the following stationary bootstrap programming to find the parameters estimate of a linear model:
X<-runif(10,0,10)
Y<-2+3*X
a<-data.frame(X,Y)
coef<-function(fit){
fit <- lm(Y~X,data=a)
return(coef(fit))
}
result<- tsboot(a,statistic=coef(fit),R = 10,n.sim = NROW(a),sim = "geom",orig.t = TRUE)
Unfortunately, I got this
2006 Apr 21
1
Feeding a sequence to a function
Dear all,
I have written a function that takes two arguments, and I would like to feed
it all pairs of values from -10 to 10. The following code works for all
pairs of values between 1 and 10, but given R's indexing, I can't extend it
back to cover the zeros and the negative values. I'd appreciate any
suggestions for a work-around.
Thanks! Fred
Tau <- matrix(0,10,10)
S2
2009 Apr 23
2
Two 3D cones in one graph
Dear R-users:
The following code produces two cones in two panels. What I would like
to have is to have them in one, and to meet in the origin. Does anyone
have any good ideas how to do this?
Thanks for your help
Jaakko
library(lattice)
A<-matrix(ncol=2, nrow=64)
for(i in 0:63)
{
A[i+1,1]<-sin(i/10)
A[i+1,2]<-cos(i/10)
}
2007 Oct 31
1
Simple Umacs example help..
Hello all...
I am just starting to teach myself Bayesian methods, and am
interested in learning how to use UMacs. I've read the
documentation, but the single example is a bit over my head at the
level I am at right now. I was wondering if anyone has any simple
examples they'd like to share. I've successfully done a couple of
simple gibbs examples, but have had a hard time
2012 Oct 05
2
problem with convergence in mle2/optim function
Hello R Help,
I am trying solve an MLE convergence problem: I would like to estimate
four parameters, p1, p2, mu1, mu2, which relate to the probabilities,
P1, P2, P3, of a multinomial (trinomial) distribution. I am using the
mle2() function and feeding it a time series dataset composed of four
columns: time point, number of successes in category 1, number of
successes in category 2, and
2011 Jan 27
1
Errors in Integrate
Hello,
I have written the function I would like to integrate in two ways:
denfxn <- function(yy,vv,a2,b2,mu2) {
pp <- 1-pnorm(yy/sqrt(vv))
part1 <- pp^(a2-1)
part2 <- (1-pp)^(b2-1)
part3 <- dnorm(yy,mu2,sqrt(vv))
return(part1*part2*part3) }
denfxnorg <- function(yy,vv,a2,b2,mu2) {
pp <- 1-pnorm(yy/sqrt(vv))
pp <- if (pp < .001) .001
else
2007 Oct 23
1
How to avoid the NaN errors in dnbinom?
Hi, The code below is giving me this error message:
Error in while (err > eps) { : missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In dnbinom(x, size, prob, log) : NaNs produced
2: In dnbinom(x, size, prob, log) : NaNs produced
I know from the help files that for dnbinom "Invalid size or prob will
result in return value NaN, with a warning", but I am not able
2006 May 21
2
nls & fitting
Dear All,
I may look ridiculous, but I am puzzled at the behavior of the nls with
a fitting I am currently dealing with.
My data are:
x N
1 346.4102 145.428256
2 447.2136 169.530634
3 570.0877 144.081627
4 721.1103 106.363316
5 894.4272 130.390552
6 1264.9111 36.727069
7 1788.8544 52.848587
8 2449.4897 25.128742
9 3464.1016 7.531766
10 4472.1360 8.827367
11
2004 Mar 02
2
Problem with Integrate
The background: I'm trying to fit a Poisson-lognormal distrbutuion to
some data. This is a way of modelling species abundances:
N ~ Pois(lam)
log(lam) ~ N(mu, sigma2)
The number of individuals are Poisson distributed with an abundance
drawn from a log-normal distrbution.
To fit this to data, I need to integrate out lam. In principle, I can
do it this way:
PLN1 <- function(lam, Count,