Displaying 20 results from an estimated 8000 matches similar to: "Problem with Newton_Raphson"
2012 Apr 16
1
R: Help; error in optim
Hello,
When i run the code below from Weibull distribution with 30% censoring by using optim i get an error form R, which states that
Error in optim(start, fn = z, data = q, hessian = T) :?
? objective function in optim evaluates to length 25 not 1
can somebody?help me remove this error. Is my censoring approach correct.
n=25;rr=1000
p=1.5;b=1.2
for (i in 1:rr){
q<-c(t,cen)
2012 Apr 14
0
R-help: Censoring data (actually an optim issue
Your function is giving NaN's during the optimization.
The R-forge version of optimx() has functionality specifically intended to deal with this.
NOTE: the CRAN version does not, and the R-forge version still has some glitches!
However, I easily ran the code you supplied by changing optim to optimx in the penultimate
line. Here's the final output.
KKT condition testing
Number of
2012 Apr 11
1
R-help; Censoring
Hello,
I wish to?censor 10% of my sample units of 50 from a Weibull distribution. Below is the code for it.
I will need to know whether what i have done is correct and if not, can i have any suggestion to improve it?
Thank you
?p=2;b=120
n=50
r=45
t<-rweibull(r,shape=p,scale=b)
meantrue<-gamma(1+(1/p))*b
meantrue
cen<- runif(n-r,min=0,max=meantrue)
cen
Chris Guure
Researcher,
2012 Aug 28
1
Optim Problem
Hello,
I want to estimate the exponential parameter by using?optim?with the following input, where t contains 40% of the data and q contains 60% of the data within an interval. In implementing the code command for optim i want it to contain both the t and q data so i can obtain the correct estimate. Is there any suggestion as to how this can be done. I have tried h<-c(t,q) but it is not working
2012 Aug 31
3
fitting lognormal censored data
Hi ,
I am trying to get some estimator based on lognormal distribution when we have left,interval, and right censored data. Since, there is now avalible pakage in R can help me in this, I had to write my own code using Newton Raphson method which requires first and second derivative of log likelihood but my problem after runing the code is the estimators were too high. with this email ,I provide
2012 Feb 05
1
R- Fisher Information
Dear All,
Can you help me, with the code below how do I obtain the fisher information from it.
Is my q<-replicate(1000,x) the right way to do simulation.
thank you.
x<-rweibull(100,0.8,1.5)
q<-replicate(1000,x)
z<-function(p){
beta<-p[1]
eta<-p[2]
log1<-(n*log(beta)-n*beta*log(eta)+(beta-1)*sum(log(x))-sum((x/eta)^beta))
return(-log1)
}
zz<-optim(c(0.5,0.5),z)
zz
Chris
2009 Mar 05
1
File checking problem
Dear all,
I am a newcomer to R programming, I met the problem:
I have a lot of .txt files in my directory.
Firstly, I check whether the file satisfies the conditions:
1.empty
2.the "Rep" column of the file has no "useractivity_idle" or
"useractivity_act"
3.even The "rep" has both of them, numbers of "useractivity_idle"==numbers of
2009 Mar 06
1
About warnings for non-matched items
Dear All,
I have many files in my directory. I want to transfer each data into one which is readable.
They have so many possibilities, i have collected(manually and visually) all possibilities and represent them as different numbers.
Rep[grep('context_log',log1$Remain[1:length(log1$Date)]),]<-"2"
Rep[grep('gs',log1$Remain[1:length(log1$Date)]),]<-"5"
2009 Mar 05
1
Import the files.
Dear all,
I am a newcomer to R programming, I met the problem:
I have a lot of .txt files in my directory.
Firstly, I check whether the file satisfies the conditions:
1.empty
2.the "Rep" column of the file has no "useractivity_idle" or
"useractivity_act"
3.even The "rep" has both of them, numbers of "useractivity_idle"==numbers of
2010 Jun 22
1
Subject: Re ZINB by Newton Raphson??
I have not included the previous postings because they came out very strangely on my mail
reader. However, the question concerned the choice of minimizer for the zeroinfl()
function, which apparently allows any of the current 6 methods of optim() for this
purpose. The original poster wanted to use Newton-Raphson.
Newton-Raphson (or just Newton for simplicity) is commonly thought to be the
2012 Aug 04
2
find errors in a directory of files
hello list,
I'm trying to write a script that will search through a directory of trace
logs for an oracle database. From what I understand new files are always
being created in the directory and it's not possible to know the exact
names of the files before they are created. The purpose of this is to
create service checks in nagios. Because you don't know the names of the
files ahead
2002 Jul 30
1
Optim() returns wrong maximum
Dear R-devel
During the last half a year I have several times encountered the
following problem with optim() when using method= "L-BFGS-B".
The function return a value which is clearly not the maximum (seen from
printing the value each time the function is called). Some output is
shown below.
A few things I have observed (as I remember it):
a. The problem seems to occur when the
2008 Dec 09
2
Need help optimizing/vectorizing nested loops
Hi,
I'm analyzing a large number of large simulation datasets, and I've
isolated one of the bottlenecks. Any help in speeding it up would be
appreciated.
`dat` is a dataframe of samples from a regular grid. The first two
columns are the spatial coordinates of the samples, the remaining 20
columns are the abundances of species in each cell. I need to calculate
the species richness in
2006 Jun 23
1
How to use mle or similar with integrate?
Hi
I have the following formula (I hope it is clear - if no, I can try to
do better the next time)
h(x, a, b) =
integral(0 to pi/2)
(
(
integral(D/sin(alpha) to Inf)
(
(
f(x, a, b)
)
dx
)
dalpha
)
and I want to do an mle with it.
I know how to use mle() and I also know about integrate(). My problem is
to give the parameter values a and b to the
2004 Mar 21
1
Multilevel analysis with package lme
Dear list,
i am a student of psychology and have to do a multilevelanalysis on some data.
About that i have one general and one specific question.
This is what i have copied from the help-file on lme:
data(bdf)
fm <- lme(langPOST ~ IQ.ver.cen + avg.IQ.ver.cen, data = bdf,
random = ~ IQ.ver.cen | schoolNR)
summary(fm)
after summary(fm) i get the following error:
2011 Sep 27
2
Error in optim function.
I'm trying to calculate the maximum likelihood estimate for a binomial
distribution. Here is my code:
y <- c(2, 4, 2, 4, 5, 3)
n <- length(y)
binomial.ll <- function (pi, y, n) { ## define log-likelihood
output <- y*log(pi)+(n-y)*(log(1-pi))
return(output)
}
binomial.mle <- optim(0.01, ## starting value
binomial.ll,
2007 Aug 16
1
Question about sm.options & sm.survival
Hi, there:
It's my first time to post question in this forum, so thanks for your
tolerance if my question is too naive. I am using a nonparametric smoothing
procedure in sm package to generate smoothed survival curves for continuous
covariate. I want to truncate the suvival curve and only display the part
with covariate value between 0 and 7. The following is the code I wrote:
2005 Oct 24
1
Error in step() (or stepAIC) for Cox model
Hello all,
I am trying to use stepwise procedure to select covariates in Cox model
and use bootstrap to repeat stepwise selection, then record how many
times variables are chosen by step() in bootstrap replications. When I
use step() (or stepAIC) to do model selection, I got errors. Here is the
part of my code
for (j in 1:mm){ #<--mm=10
for (b in 1:nrow(reg.bs)){ #<--bootstrap 10
2004 Dec 09
1
System is computationally singular?
Hi all,
I was using the Newton-Raphson method to estimate paremeters in the model developed by my supervisor. However, when I interatively computed theta(t+1)=theta(t) - solve(H)*s (where the Hessian matrix and score vector were explicitely derived), I got the error message: Error in solve.default(H) : system is computationally singular: reciprocal condition number = 1.70568e-032. Assume my score
2005 Jan 11
1
lme4 print and summary errror
Hi all - (this is posted to r-help and R-SIG-MAC)
OSX 10.3.7, R 2.0.1, lme4/Matrix/latticeExtra latest, fresh install of
R. MASS loaded (or not).
I am getting an error message for the print() and summary() commands
with all lme models I try and run in lme4 (GLMM's work fine). Using
the example from the lme help, summary and print produce the following
errors, despite the model being