Re: [R] invalid function value in 'nlm' optimizer

2015-04-29 Thread Hanze Zhang
Dunlap TIBCO Software wdunlap tibco.com On Tue, Apr 28, 2015 at 6:40 PM, Hanze Zhang kevin511...@gmail.com wrote: I still cannot solve the problem: 'invalid function value in 'nlm' optimizer' I want to get the MLE for theta[1] and theta[2], my code is below: x - c(2,5,3,7,3,2,4) delta

Re: [R] invalid function value in 'nlm' optimizer

2015-04-28 Thread Hanze Zhang
)*log(theta[1]*theta[2])-sum(delta)*(theta[1]-1)*log(x[delta==1])+theta[2]*sum(x^theta[1]) } #MLE nlm(ln,theta-c(1,1),x1=x, x2=delta, hessian=TRUE) On Tue, Apr 28, 2015 at 6:40 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On 28/04/2015 2:43 AM, Hanze Zhang wrote: Hi, R users, I am

[R] invalid function value in 'nlm' optimizer

2015-04-28 Thread Hanze Zhang
Hi, R users, I am using nlm function to get the MLE of parameter alpha and lambda from a parametric survival model (Weibull distribution). However, this message always came out: ' invalid function value in 'nlm' optimizer'. Could anyone help me? Code is project-read.table(file=C://data.txt,

[R] R2WINBUGS Error message

2014-09-18 Thread Hanze Zhang
Hi, guys, I am a new user for package R2winbugs. When I run the code a=bugs(...), an error message always comes out, see below: Error in file(con, wb) : cannot open the connection In addition: Warning messages: 1: In file.create(to[okay]) : cannot create file 'c:/Program

Re: [R] problem on package survey , function svyglm,

2014-04-16 Thread Hanze Zhang
Thank you, guys. I merged strata and fitted my model. On Wed, Apr 16, 2014 at 5:33 PM, Thomas Lumley tlum...@uw.edu wrote: On Tue, Apr 15, 2014 at 7:07 AM, Milan Bouchet-Valat nalimi...@club.frwrote: Le lundi 14 avril 2014 à 13:59 -0400, Hanze Zhang a écrit : Hi, I want to do

[R] how to do poisson regression for a complex sample design data by svyglm

2014-04-14 Thread Hanze Zhang
Hi, I am in trouble on doing poisson regression for a complex sample design data by svyglm (survey package). I have a dataset contained these variables: caseumber, y(which is count), x1, x2, stratum, weight. It is a complex sample design with equal probability without replacement. How can I fit a

[R] problem on package survey , function svyglm,

2014-04-14 Thread Hanze Zhang
Hi, I want to do logistic regression based on a complex sample design. I used package survey, but when I ran svyglm, an error message came out: Error in onestrat(x[index, , drop = FALSE], clusters[index], nPSU[index][1], : Stratum (16) has only one PSU at stage 1 My code is below: