[R] Mahalanobis distance with mixed data

2010-10-05 Thread R_help Help
Hi, I can see that there is a function for mahalanobis distance in stat package. But I'm wondering if there is any implementation that can take in a mix of ordinal data and numerical values together? If no, would you mind pointing me to some reference for a methodology to do this? Thank you in

Re: [R] Need help to understand integrate function

2010-08-12 Thread R_help Help
. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: R_help

[R] Need help to understand integrate function

2010-08-11 Thread R_help Help
Hi, I'm running into a wall when trying to use the integrate function. I have the following setting: powerLaw2 - function(x,l1,l2,c0,t0) { idx - which(x = 0); if (length(idx) 0) { x[idx] - 0; } xl - (-l1+l2)*log(x/t0); L - log(c0)-l1*log(x)-log(1+exp(xl)); L - exp(L);

[R] Adding RcppFrame to RcppResultSet causes segmentation fault

2010-03-29 Thread R_help Help
Hi, I'm a bit puzzled. I uses exactly the same code in RcppExamples package to try adding RcppFrame object to RcppResultSet. When running it gives me segmentation fault problem. I'm using gcc 4.1.2 on redhat 64bit. I'm not sure if this is the cause of the problem. Any advice would be greatly

[R] Creating Rcpp RcppDatetime from string with millisecond

2010-03-18 Thread R_help Help
Hi, I was trying to generate RcppDatetime from a string. The main problem for me is that my string contains millisecond. I saw that RcppDatetime takes in double of seconds since epoch. I try to generate a double using boost but has no success. I'm wondering if you have any sample snippet? The

[R] Fitting ACD model

2009-12-22 Thread R_help Help
Hi - I'm wondering if there is any existing package in R that facilitates ACD (Autoregressive Conditional Duration) model. I googled. Apparently there were packages dynamo and fACD. However, they do not seem to be on any CRAN. I am wondering if anyone could point me to an existing package (if

[R] Sequential MLE on time series with rolling window

2009-11-03 Thread R_help Help
Hi, Assuming I have a time series on which I will perform rolling-window MLE. In other words, if I stand at time t, I'm using points t-L+1 to t for my MLE estimate of parameters at time t (here L is my rolling window width). Next, at t+1, I'll do the same. My question is that is there anyway to

[R] Fast optimizer

2009-10-29 Thread R_help Help
Hi, I'm using optim with box constraints to MLE on about 100 data points. It goes quite slow even on 4GB machine. I'm wondering if R has any faster implementation? Also, if I'd like to impose equality/nonequality constraints on parameters, which package I should use? Any help would be

Re: [R] Fast optimizer

2009-10-29 Thread R_help Help
. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: R_help Help rhelp

[R] Poisson dpois value is too small for double precision thus corrupts loglikelihood

2009-10-26 Thread R_help Help
Hi - I have a likelihood function that involves sums of two possions: L = a*dpois(Xi,theta1)*dpois(Yi,theta2)+b*(1-c)*a*dpois(Xi,theta1+theta3)*dpois(Yi,theta2) where a,b,c,theta1,theta2,theta3 are parameters to be estimated. (Xi,Yi) are observations. However, Xi and Yi are usually big (

[R] Plot log scale

2009-10-21 Thread R_help Help
Hi - a simple question. I know that on plot one can set log=xy to set scale on both axes to log scale. I use this to plot autocorrelation of a slow decaying autocorrelated process. It has some points that are zero or slightly negative and cause this plot to return error. I'm wondering if there is

[R] Evaluating/comparing dynamic linear model

2009-10-07 Thread R_help Help
Hi, I have two DLM model specifications (x[t] and y[t] are univariate): MODEL1: y[t] = b[t]x[t]+e[t], e[t] ~ N(0,v1^2) b[t] = b[t-1]+eta[t], eta[t] ~ N(0,w1^2) MODEL2: y[t] = a[t]+e[t], e[t] ~ N(0,v2^2) a[t] = a[t-1]+eta[t], eta[t] ~ N(0,w2^2) I run the filter through data recursively to

[R] how to fit time varying coefficient regression model?

2009-10-05 Thread R_help Help
Hi - I read through dse package manual a bit. I'm not quite certain how I can use it to estimate a time varying coefficient regression model? I might pick up an inappropriate package. Any suggestion would be greatly appreciated. Thank you. rh __

Re: [R] [R-SIG-Finance] Aggregating irregular time series

2009-09-08 Thread R_help Help
wrote: -- Forwarded message -- From: Gabor Grothendieck ggrothendi...@gmail.com Date: Sun, Aug 30, 2009 at 11:08 PM Subject: Re: [R-SIG-Finance] Aggregating irregular time series To: R_help Help rhelp...@gmail.com Cc: r-sig-fina...@stat.math.ethz.ch, r-help@r-project.org Try

[R] Aggregating irregular time series

2009-08-30 Thread R_help Help
Hi, I have a couple of aggregation operations that I don't know how to accomplish. Let me give an example. I have the following irregular time series time                              x 10:00:00.021                20 10:00:00.224                20 10:00:01.002                19 10:00:02:948      

[R] aggregating irregular time series

2009-08-29 Thread R_help Help
Hi, I have a couple of aggregation operations that I don't know how to accomplish. Let me give an example. I have the following irregular time series time x 10:00:00.02120 10:00:00.22420 10:00:01.00219 10:00:02:948

[R] POSIX time conversion doesn't display digit

2009-08-29 Thread R_help Help
Hi, I have the following string that I converted to a POSIXct: a - 2009-08-24 10:00:00.213 a.p - strptime(a,%Y-%m-%d %H:%M:%OS) as.double(as.POSIXct(a.p)) [1] 1251122400 I can't seem to get the decimal fraction of .213 out by casting to double or numeric. Is there anyway to make sure that

[R] Smart way to sum a column in a matrix across all members in a list

2009-08-11 Thread R_help Help
Hi, I have a list that contains about 100 elements. Each element contains the following matrix structure a b 1 1 4 2 2 5 3 3 6 I'd like to sum column b across all elements. I'm thinking of using lapply or sapply but cannot get it to work. Any help would be really appreciated. Thank you.

[R] How to read and write an S4 class

2009-08-11 Thread R_help Help
Hi, I have an object in S4 class. Is there anyway that I can write to a file and read it back to R? Thank you. adschai __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] Defining class as a member of another class

2009-06-27 Thread R_help Help
Hi, When I define a new class (through setClass), members defined in representation argument doesn't seem to like a class. For example, if I do the following: setClass(NotWork,representation=(x=zoo)) It seems to me that representation members will take in only primitive type to R. Is there any

Re: [R] Defining class as a member of another class

2009-06-27 Thread R_help Help
Thank you Gabor. It works. I read a bit more and understood what you're doing. One more question, I want to know more about .Data property of a class. I know that it defines type of the class when asking typeof. But I don't know much how to use them. Would you mind pointing me to some reference

Re: [R] apply on xts

2009-06-25 Thread R_help Help
Thanks David for reading for me. Anyhow, is there better way to do looping on xts objects than using apply? Thanks again. adschai On Thu, Jun 25, 2009 at 12:39 AM, David Winsemius dwinsem...@comcast.netwrote: On Jun 24, 2009, at 9:26 PM, R_help Help wrote: Hi, I do not understand why

[R] apply on xts

2009-06-24 Thread R_help Help
Hi, I do not understand why after I called apply on a function that returns an xts (getIdvAdjSeries) it returns a matrix whose columns are just numeric value of time series in xts instead of a list of xts objects. Basically, I called the following:

[R] Can hist plot % of count instead of raw count?

2009-06-24 Thread R_help Help
I do not want to use histogram because I have more control over base graphs that R provide. I'm wondering if hist function provides a parameter that can set y axis as % of count instead of raw count? If not, I'd like to know how I can add text or line on histogram function? I don't like the idea

[R] lapply across using multiple columns

2009-06-23 Thread R_help Help
Hi, To set a simple an clear picture of what I'd like to do, here is an example. I would like to calculate mean of column A and B bucketed by factor in column X in a data.frame. lapply or aggregate operates on a single column. I found dapply function in some package which doesn't seem to exist

[R] Smart way to check if a column with certain name exists in a data.frame

2009-06-22 Thread R_help Help
Hi, I have a matrix or data.frame (df). When I would like to check if a column named x exists, it becomes my habit to do the following: if (length(which(colnames(df)==x))0) Is there any smarter way to do this? Thank you. adschai [[alternative HTML version deleted]]

[R] Need help installing xts package

2009-06-20 Thread R_help Help
Hi, I am trying to install package xts. I am using OPENSUSE 11 64 bit. When I invoke: install.pacakges(xts,dependencies=T) I received a lot of ERROR: compilation failed for package errors when R tries to install xts dependencies. I do not understand this behavior. I notice one thing. It