Displaying 20 results from an estimated 100 matches similar to: "newton method for single nonlinear equation"
2010 Jan 26
1
Newton method
Hi r-users,
I hope somebody can help me with this code.
I would like to solve for z values using newton iteration method. I 'm not sure which part of the code is wrong since I'm not very good at programming but would like to learn. There seem to be some output but what I expected is a vector of z values. Thank you so much for any help given.
newton.inputsingle <-
2010 Feb 10
1
looping problem
Hi R-users,
I have this code here:
library(numDeriv)
fprime <- function(z)
{ alp <- 2.0165;
rho <- 0.868;
# simplified expressions
a <- alp-0.5
c1 <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)
c2 <- sqrt(rho)/(1-rho)
t1 <- exp(-z/(1-rho))
t2 <- (z/(2*c2))^a
bes1 <- besselI(z*c2,a)
t1bes1 <- t1*bes1
c1*t1bes1*t2
}
## Newton
2010 Feb 09
0
For and while in looping
I would like to solve a nonlinear eqn using newton method and here is the code:
library(numDeriv)
fprime <- function(z)
{ alp <- 2.0165;
rho <- 0.868;
# simplified expressions
a <- alp-0.5
c1 <- sqrt(pi)/(gamma(alp)*(1-rho)^alp)
c2 <- sqrt(rho)/(1-rho)
t1 <- exp(-z/(1-rho))
t2 <- (z/(2*c2))^a
bes1 <- besselI(z*c2,a)
2010 Feb 15
1
error message error
Hi r-users,
I hope somebody can help me to understand the error message. Here is my code;
## Newton iteration
newton_gam <- function(z)
{ n <- length(z)
r <- runif(n)
tol <- 1E-6
cdf <- vector(length=n, mode="numeric")
fprime <- vector(length=n, mode="numeric")
f <- vector(length=n, mode="numeric")
for (i in 1:1000)
{
2010 Feb 09
1
how to adjust the output
Hi R-users,
I have this code below and I understand the error message but do not know how to correct it. My question is how do I get rid of “with absolute error < 7.5e-06” attach to value of cdf so that I can carry out the calculation.
integrand <- function(z)
{ alp <- 2.0165
rho <- 0.868
# simplified expressions
a <- alp-0.5
c1 <-
2004 Feb 10
1
generate random sample from ZINB
I want to generate 1,000 random samples of sample size=1,000 from ZINB.
I know there is a rnegbin() to generate random samples from NB, and I know
I can use
the following process:
do i=1 to 1000
n=0
do i=1 to 1000
if runi(1)>0.1 then x(i) = 0; else
x(i)=rnegbin();
n=n+1;
if n>1000 then stop;
end;
output;
end;
Anybody can help me out with the R code?
Thanks very much ahead of time.
2011 Feb 09
2
Generate multivariate normal data with a random correlation matrix
Hi All.
I'd like to generate a sample of n observations from a k dimensional
multivariate normal distribution with a random correlation matrix.
My solution:
The lower (or upper) triangle of the correlation matrix has
n.tri=(d/2)(d+1)-d entries.
Take a uniform sample of n.tri possible correlations (runi(n.tr,-.99,.99)
Populate a triangle of the matrix with the sampled correlations
Mirror the
2007 Jan 14
2
RE : TDM2400p bad sound quality
Hi Francois,
Thank you for your interest.
I tried the card alone so I don't think is an IRQ problem (anyway is there a
way to be sure?)
To be sincere, in all systems I saw (even working ones) there is an IRQ
balance failed where Linux boots.
The system is new, I tried different processors (P4 and Celeron) with SMP
kernel and without.
The card has the echo module, could not be
2004 Jan 04
2
Which ( any ) windows dlls should be moved to wine?
I'm runiing wine-20031212 on a dual boot machine. I have both win98 and
w2k installed.
Other posts have suggested these be copied. Is the the right - complete?
-set?
advapi32.dll
comctl32.dll
ddraw.dll
gdi32.dll
kernel32.dll
mfc42.dll
msvcrt.dll
ole32.dll
rpcrt4.dll
shell32.dll
shlwapi.dll
user32.dll
sean
2023 Dec 04
1
OMV + NUT + TrippLite OMNIVSX850
Hello,
I am try to get my "new" UPS running with NUT on my OpenMediaVault device
but only receive error meassages on several configurations I try.
Your support is really appreciated for getting it solved.
Best Regards, Olaf
*lsusb*
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID
2016 Jun 02
4
Floating Point SCEV Analysis
For reference, the case with a variable loop count is filed as PR27894:
https://llvm.org/bugs/show_bug.cgi?id=27894
And the case with a constant loop count is filed as PR27899:
https://llvm.org/bugs/show_bug.cgi?id=27899
On Thu, Jun 2, 2016 at 7:48 AM, Demikhovsky, Elena via llvm-dev <
llvm-dev at lists.llvm.org> wrote:
> I implemented IV simplification with FP SCEV and uploaded a new
2003 Aug 20
2
Method of L-BFGS-B of optim evaluate function outside of box constraints
Hi, R guys:
I'm using L-BFGS-B method of optim for minimization problem. My function
called besselI function which need non-negative parameter and the besselI
will overflow if the parameter is too large. So I set the constraint box
which is reasonable for my problem. But the point outside the box was
test, and I got error. My program and the error follows. This program
depends on CircStats
2007 Jun 18
1
two bessel function bugs for nu<0
#bug 1: besselI() for nu<0 and expon.scaled=TRUE
#tested with R-devel (2007-06-17 r41981)
x <- 2.3
nu <- -0.4
print(paste(besselI(x, nu, TRUE), "=", exp(-x)*besselI(x, nu, FALSE)))
#fix:
#$ diff bessel_i_old.c bessel_i_new.c
#57c57
#< bessel_k(x, -alpha, expo) * ((ize == 1)? 2. : 2.*exp(-x))/M_PI
#---
#> bessel_k(x, -alpha, expo) * ((ize == 1)? 2. :
2009 Jun 03
2
code for double sum
Hi R-users,
I wrote a code to evaluate double sum as follows:
ff2 <- function(bb,eta,z,k)
{ r <- length(z)
for (i in 1:r)
{ sm1 <- sum((z[i]*bb/2)*(psigamma((0:k)+eta+1,deriv=0)/(factorial(0:k)*gamma((0:k)+eta+1))))
sm2 <- sum((besselI(z[i]*bb,eta)*log(z[i]*bb/2) - sm1)/besselI(z[i]*bb,eta))
sm2
}
ff2(bb,eta,z,10)
but it gave me the following message:
>
2002 Dec 11
3
Modified Bessel Function - 2nd kind
In order to fit a probability distribution proposed by Sichel [Journal of
the Royal Statistical Society. Series A (General), Vol. 137,
No. 1. (1974), pp. 25-34], I need a modified Bessel function of the 2nd
kind. I notice that the base package of "R" only has modified Bessel
functions of the 1st and 3rd kind. Does a modified Bessel function of the
2nd kind exist anywhere?
Many
2002 Nov 26
2
Existence of non-vectorised functions
Dear R-Group:
Recently, I ran into a problem. I was using a function called "I.1",
which evaluates the first-order modified Bessel function of the first
kind, in the package "CircStats". This function is not vectorized,
since it uses a couple of "if" conditions. However, when I called this
function with a vector argument, I got no error/warning messages in
2009 Mar 23
4
newton method
Hi R-users,
Does R has a topic on newton's method?
Thank you for the info.
2010 Jun 15
1
Error in nlm : non-finite value supplied by 'nlm'
Hello,
I am trying to compute MLE for non-Gaussian AR(1). The error term follows a difference poisson distribution. This distribution has one parameter (vector[2]).
So in total I want to estimate two parameters: the AR(1) paramter (vector[1]) and the distribution parameter.
My function is the negative loglikelihood derived from a mixing operator.
f=function(vector)
2007 Sep 11
1
Fitting Data to a Noncentral Chi-Squared Distribution using MLE
Hi, I have written out the log-likelihood function to fit some data I have (called ONES20) to the non-central chi-squared distribution.
>library(stats4)
>ll<-function(lambda,k){x<-ONES20; 25573*0.5*lambda-25573*log(2)-sum(-x/2)-log((x/lambda)^(0.25*k-0.5))-log(besselI(sqrt(lambda*x),0.5*k-1,expon.scaled=FALSE))}
> est<-mle(minuslog=ll,start=list(lambda=0.05,k=0.006))
2004 Dec 14
1
increase thr range in R
Hello Everybody in order to get some needed results out of my function i
need to get my besselI function evaluated at some values which normally gave
Inf or 0 (expon.scaled NAN) back. So I would like to increase the range in R
from approxamittly 1e+320 to aabout 1e+500 or something like that. Is there
any possibility or pacckage to do this easily?
Thank You
Sebastian Kaiser
Institut for Statistics