[R] How to set parameters constraints in a function?

2010-05-24 Thread Carol Gao
Dear R list, I have a function specifying my log-likelihood, and now I need to set the constraint that *alpha > kappa*, could anyone help me with setting this in my function? the function is defined as follows: mll <- function(param){ n <- length(x) psi <- numeric(n) psi[1] <- 1.0 a0 <-

Re: [R] problem in using optim

2010-05-08 Thread Carol Gao
That was great! I tried as what you said, not as many warnings as before, and it seems that it converges. Thank you Berend. and thank you all! Carol On Sat, May 8, 2010 at 5:00 PM, Berend Hasselman wrote: > > > Carol Gao wrote: > > > > I have generated some random vari

Re: [R] problem in using optim

2010-05-07 Thread Carol Gao
t a > solution (e.g. bounds constraints). If you need better help, you have to > send us a minimal, self-contained, reproducible example. > > Ravi. > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On > Behalf O

[R] problem in using optim

2010-05-07 Thread Carol Gao
? Thanks in advance. Carol Gao [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide

[R] select subset of data according to date range

2010-04-30 Thread Carol Gao
Dear R lists, Would anyone help me with setting data frames according to the date? X.RIC Date.G. Time.G. GMT.Offset Type Price VolumeTime 1 QAN.AX 01-DEC-2008 00:00:28.611 11 Trade 2.28105 2008-12-01 11:00:28.611 2 QAN.AX 01-DEC-2008 00:00:43.155

Re: [R] time zone convert

2010-04-29 Thread Carol Gao
1:05 AM, Carol Gao wrote: > that's weird. I opened a new R window and paste your code, it turns up > showing > > > anz1 <- data.frame(Date.G = c("01-DEC-2008", > "01-DEC-2008","02-DEC-2008","03-DEC-2008","04-DEC-2008"),

Re: [R] time zone convert

2010-04-29 Thread Carol Gao
,"00:04:03.778","00:04:38.639","00:04:38.639","00:04:38.639")) > > Time <- strptime(paste(anz1$Date.G, anz1$Time.G), '%d-%b-%Y %H:%M:%S') > modifyList(Time, list(hour = Time$hour + 11)) [1] NA NA NA NA NA What could possibly be the reas

Re: [R] time zone convert

2010-04-29 Thread Carol Gao
ique Dallazuanna wrote: > Ops, > > I sent to you a wrong code, try this indeed: > > Time2 <- strptime(Time, '%d-%b-%Y %H:%M:%S') > > modifyList(Time2, list(hour = Time2$hour + 11)) > > On Thu, Apr 29, 2010 at 11:14 AM, Carol Gao wrote: > >> Apprecia

Re: [R] time zone convert

2010-04-29 Thread Carol Gao
"%d-%b-%Y %H:%M:%OS". Should I change any code above? Carol On Thu, Apr 29, 2010 at 11:47 PM, Henrique Dallazuanna wrote: > Try this: > > Time2 <- gsub("\\.*", "", tolower(Time)) > modifyList(Time2, list(hour = Time2$hour + 11)) > > > On

[R] time zone convert

2010-04-29 Thread Carol Gao
Hi there, I've got a column vector in a csv file as follows, and I need to add 11 hours to each of them. Is there a way that I can do it? (The actual file size is much bigger than this.) Time "01-DEC-2008 00:00:28.611" "01-DEC-2008 00:00:43.155" "01-DEC-2008 00:01:06.677" "01-DEC-2008 00:01:06.67

Re: [R] Adding new column variable to a existing spreadsheet

2010-04-23 Thread Carol Gao
ata$newcolumn <- [in here put the expression for your new column] > > for example: > > my.data$newcolumn <- my.data$firstcolumn + my.data$secondcolumn > > On Fri, Apr 23, 2010 at 9:49 PM, Carol Gao wrote: > > Hi, > > > > I've got a csv format of file. T

[R] Adding new column variable to a existing spreadsheet

2010-04-23 Thread Carol Gao
an do this? Thanks in advance. Carol Gao [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html a

Re: [R] time difference

2010-04-22 Thread Carol Gao
2010-04-22 13:45:34" > > format(x, format="%H:%M:%OS3") > [1] "13:45:34.123" > > > > > On Thu, Apr 22, 2010 at 2:58 AM, Carol Gao wrote: > >> Hi, >> >> Does anyone know how to take a time difference when the format of the tim

[R] time difference

2010-04-21 Thread Carol Gao
that doesn't work. Carol Gao [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide