Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread Frede Aakmann Tøgersen
It has to do with setting a to large upper bound for the gamma parameter. However, we are estimating the value of gamma because we do not know it so how can we set an upper bound for gamma?? Perhaps other optimization algorithms in optim() can be used (Nelder-Mead works for this x at least).

Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread Prof Brian Ripley
On 18/01/2014 09:06, Frede Aakmann Tøgersen wrote: It has to do with setting a to large upper bound for the gamma parameter. However, we are estimating the value of gamma because we do not know it so how can we set an upper bound for gamma?? You have starting values, so have some idea of the

Re: [R] *** caught segfault *** :: a common problem in 3.0.2

2014-01-18 Thread Frede Aakmann Tøgersen
I think you are trying to access memory that you are not allowed to. Or did you specify the type of all of your data to be of the right ones? The segfault message at least say so. *** caught segfault *** address 0x2464943a08, cause 'memory not mapped' Traceback: 1: .Call(gyroscope,

Re: [R] For loop on column names

2014-01-18 Thread Frede Aakmann Tøgersen
Hi Try for (cname in colnames(mydf)) print((percent(length(is.null(mydf [, cname]) / lines)) Br. Frede Oprindelig meddelelse Fra: Jeff Johnson Dato:18/01/2014 02.10 (GMT+01:00) Til: R help Emne: [R] For loop on column names I'm trying to find a more efficient to calculate

Re: [R] eliminating white space in lattice plot

2014-01-18 Thread Duncan Mackay
I forgot to mention for multiple plots ? print.trellis Duncan -Original Message- From: Gerrit Draisma [mailto:gdrai...@xs4all.nl] Sent: Saturday, 18 January 2014 21:49 To: arun; Duncan Mackay Subject: Re: [R] eliminating white space in lattice plot Ha Arun and Duncan, Thanks for your

[R] MULTINOMIAL LOGIT WITH ENDOGENEITY

2014-01-18 Thread Erasmo Papagni
My aim is to estimate a multinomial model with some endogenous variables. I tried the control function approach but the results are rather bad. I am thinking to ML estimation. Is there a package I can use to estimate this model? Thanks a lot Erasmo Papagni Department of economics

Re: [R] Generate Variable Length Strings from Various Sources

2014-01-18 Thread Burhan ul haq
Hi Rainer, Thanks for the tip. Your suggestion works perfectly, however as per the R Mantra of avoiding for loops, I propose the following this alternate: # number of strings to be created n - 50 # random length of each string v.length = sample( c( 2:4), n, rep = TRUE ) # letter sources

Re: [R] For loop on column names

2014-01-18 Thread Bert Gunter
I doubt it. 1. The OP failed to specify how populatedness is defined. Is it NULL, NA, , ,...? 2. What is percent() ? Is this the OP's function or one from a package or pseudocode or ... ? 3. lapply(df,function) is generally preferable in R to: for(name in colnames(df)) function(df[ ,name])

Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread Vito Ricci
Hi Rolf, I fit 3 parameters lognormal in this way myf-function(x,m,s,t)(1/((x-t)*s*(2*pi)^0.5))*exp(((-(log(x-t)-m)^2)/(2*s^2))) then fitdistr(y, myf, list(m=1,s=1, t=2)) I choose initial parameters value seeing data, I noted that a goog estimate of t would be 2...Me too I've some errors,

Re: [R] xts error: number of items to replace is not a multiple of replacement length

2014-01-18 Thread Joshua Ulrich
This is particularly complicated and a bit of an edge case, so I wouldn't try too hard to understand what's going on, but I'll try to explain anyway. Your code creates two calls to the subset-replacement function (xts:::`[-.xts`). The first call replaces the value of Close in a temporary copy of

Re: [R] shading and estimating area abetween two cdf curves

2014-01-18 Thread William Dunlap
These examples do not apply to the objects generated by the ecdf function. Look at the objects generated by the ecdf function and you will see that they are functions, not vectors of numbers (the 'f' in ecdf stands for 'function'). You need to apply the functions to vectors of numbers to get

Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread peter dalgaard
Offhand, I'd say that the issue isn't so much the starting values as the risk of hitting the upper bound on gamma. If you get gamma set to min(x) at any point during the iteration, the density at the corresponding point is zero, the log-likelihood is -Inf, and poof, the magic smoke escapes.

Re: [R] Generate Variable Length Strings from Various Sources

2014-01-18 Thread Jeff Newmiller
People who subscribe to an avoid-for-loops mantra are often missing the point. Converting for loops to indexing can often yield speed improvements. Converting for loops to apply functions does not improve speed. (If you think it does, you are probably handling memory allocation differently.)

[R] accessing an object with a variable ?

2014-01-18 Thread ce
I want access and object , its name is in an variable : require(xts) data(sample_matrix) head(sample_matrix) Open High LowClose 2007-01-02 50.03978 50.11778 49.95041 50.11778 2007-01-03 50.23050 50.42188 50.23050 50.39767 2007-01-04 50.42096 50.42096 50.26414

Re: [R] Estimating parameters of 3 parameters lognormal distribution

2014-01-18 Thread Rolf Turner
On 19/01/14 06:20, peter dalgaard wrote: Offhand, I'd say that the issue isn't so much the starting values as the risk of hitting the upper bound on gamma. If you get gamma set to min(x) at any point during the iteration, the density at the corresponding point is zero, the log-likelihood is

Re: [R] accessing an object with a variable ?

2014-01-18 Thread ce
Yes, it works perfect, thanks a lot. -Original Message- From: Marius 't Hart [mar...@ai178182.ai.rug.nl] Date: 01/18/2014 04:58 PM To: ce zadi...@excite.com CC: r-help@r-project.org Subject: Re: [R] accessing an object with a variable ? Does this help you?

Re: [R] accessing an object with a variable ?

2014-01-18 Thread arun
May be this helps:  assign(a,eval(parse(text=b))) A.K. On Saturday, January 18, 2014 4:24 PM, ce zadi...@excite.com wrote: I want access and object , its name is in an variable : require(xts) data(sample_matrix) head(sample_matrix)               Open    High      Low    Close 2007-01-02

[R] remove axes on barp from plotrix

2014-01-18 Thread Chrisee
Hello guys, I'm using the barp function from the plotrix package, which works really really great. Unfortunately, I need a finer spacing of the labels on the y - axis. Is there any way to control this? Looking at the documentation of barp, it seems to be done rather automatically. An option

Re: [R] *** caught segfault *** :: a common problem in 3.0.2

2014-01-18 Thread Christopher T Gregg
Thank you, Frede. I will look into these suggestions. I did not specify the data type carefully…I will assess this and see if it cleans up the problem. best wishes, Chris On Jan 18, 2014, at 2:23 AM, Frede Aakmann Tøgersen fr...@vestas.com wrote: I think you are trying to access memory

[R] Fwd: Implementing a Formula into a Column of a Data Frame

2014-01-18 Thread Norman McBride
-- Forwarded message -- From: Norman McBride npmcbride0...@gmail.com Date: Fri, Jan 17, 2014 at 9:54 AM Subject: Implementing a Formula into a Column of a Data Frame To: r-help@r-project.org Now, if I were to move the data over from an excel doc would that change anything. I do

[R] 2 phase coxian phase distribution

2014-01-18 Thread nelsonsibbs78
Can you pliz  send me the R code for estimating parameters of a 2 phase distribution given some data to fit. Im nelson sibanda , a final year student at Nust [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] accessing an object with a variable ?

2014-01-18 Thread Marius 't Hart
Does this help you? http://stackoverflow.com/questions/3971844/access-variable-value-where-the-name-of-variable-is-stored-in-a-string-in-r On Sat, 18 Jan 2014, ce wrote: I want access and object , its name is in an variable : require(xts) data(sample_matrix) head(sample_matrix)

[R] lm(y ~ group/x ) + predict.lm(...,type=terms)

2014-01-18 Thread Xing Zhao
Hi, all I am trying to figure out the computation result for predict.lm(...,type=terms) when the original fitting model has a nesting term, lm(y ~ group/x ). A example, set.seed(731) group - factor(rep(1:2, 200)) x - rnorm(400) fun1 - function(x) -3*x+8 fun2 - function(x) 15*x-18 y -

[R] lm(y ~ group/x ) + predict.lm(...,type=terms)

2014-01-18 Thread Xing Zhao
Hi, all I am trying to figure out the computation result for predict.lm(...,type=terms) when the original fitting model has a nesting term, lm(y ~ group/x ). A example, set.seed(731) group - factor(rep(1:2, 200)) x - rnorm(400) fun1 - function(x) -3*x+8 fun2 - function(x) 15*x-18 y -

Re: [R] accessing an object with a variable ?

2014-01-18 Thread Marius 't Hart
Does this help you? http://stackoverflow.com/questions/3971844/access-variable-value-where-the-name-of-variable-is-stored-in-a-string-in-r On 14-01-18 04:21 PM, ce wrote: I want access and object , its name is in an variable : require(xts) data(sample_matrix) head(sample_matrix)

[R] lm(y ~ group/x ) + predict.lm(...,type=terms)

2014-01-18 Thread Xing Zhao
Hi, all I am trying to figure out the computation result for predict.lm(...,type=terms) when the original fitting model has a nesting term, lm(y ~ group/x ). A example, set.seed(731) group - factor(rep(1:2, 200)) x - rnorm(400) fun1 - function(x) -3*x+8 fun2 - function(x) 15*x-18 y -

Re: [R] lm(y ~ group/x ) + predict.lm(...,type=terms)

2014-01-18 Thread Prof Brian Ripley
Please see the posting guide: posting 3 times only reduces your chance of an informative answer (as does posting in HTML). Your posting is too vague for others to know what it is you do not understand. R is Open Source: please read the sources for the definitive answer to the 'know the