search for: rhelpacc

Displaying 20 results from an estimated 32 matches for "rhelpacc".

2009 Oct 30
3
Fast optimizer
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 appreciated. Thank you. rc
2009 Aug 30
2
aggregating irregular time series
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 20 1) For each entry time, I'd like to get sum of x for the next 2 seconds
2009 Jun 24
2
lapply across using multiple columns
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 any more. Is there anyway that I can accomplish something like this? Thank you so much in
2009 Jun 21
1
Need help installing xts package
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 complains. ERROR: compilation failed for package 'Hmisc' ** Removing
2009 Jun 23
1
Smart way to check if a column with certain name exists in a data.frame
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]]
2009 Jun 28
1
Defining class as a member of another class
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 way to stuff a class as a member in another class? Thank you. - adschai
2009 Aug 12
1
Smart way to sum a column in a matrix across all members in a list
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. adschai
2009 Aug 30
2
POSIX time conversion doesn't display digit
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 POSIXct spits that out? Thank you. adschai
2011 Nov 06
1
Double integration using R
Hi, I have a function that I need to do double integration: \int^T_0 \int^t_0 N(\delta / \sigma \sqrt(u)) (1-N(\delta / \sigma \sqrt(u))) du dt where N(x) is a standard normal probability of x. I start off by writing an inner integral into a function. Meaning \int^t_0 N(\delta,\sigma \sqrt(u)) (1-N(\delta,\sigma \sqrt(u))) du. Then calling integrate function on this function. This
2010 Aug 12
1
Need help to understand integrate function
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); return(L); } plCDF2 <- function(x,l1,l2,c0,t0) {
2009 Oct 06
2
how to fit time varying coefficient regression model?
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
2010 Mar 30
1
Adding RcppFrame to RcppResultSet causes segmentation fault
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 appreciated. Thank you. Rob. int numCol=4; std::vector<std::string>
2012 Jan 11
2
Finding percentile of a value from an empirical distribution
Hello, I am not sure how to do this in R. Any suggestion would be appreciated. I have a vector of values from where I build an empirical CDF. For example: > x <- seq(1,100) > x <- sample(x,1000,replace=T) > quantile(x,probs=seq(0,1,.05)) 0% 5% 10% 15% 20% 25% 30% 35% 40% 45% 50% 55% 1.00 5.00 10.00 16.00 20.00 25.00 31.00 36.00 41.00
2009 Sep 01
1
Logistic Politomic Regression in R
...al, self-contained, reproducible code. > -- Regards, Ishwor Gurung ------------------------------ Message: 4 Date: Sun, 30 Aug 2009 08:42:09 -0400 From: Gabor Grothendieck <ggrothendieck@gmail.com> Subject: Re: [R] POSIX time conversion doesn't display digit To: R_help Help <rhelpacc@gmail.com> Cc: r-help@r-project.org Message-ID:     <971536df0908300542r5a59097cn48ec0b8f333626d1@mail.gmail..com> Content-Type: text/plain; charset=ISO-8859-1 Try this: > options(digits = 20) > as.double(as.POSIXct(a.p)) [1] 1251122400.213 On Sat, Aug 29, 2009 at 11:37 PM, R_hel...
2009 Jun 25
1
apply on xts
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: apply(matrix(tickers,ncol=1),1,FUN=getDivAdjSeries) getDivAdjSeries <- function(ticker) { seriesName <-
2009 Jun 25
1
Can hist plot % of count instead of raw count?
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 of having to use raw coordinates to set text position. Thank you. adschai [[alternative
2009 Nov 04
1
Sequential MLE on time series with rolling window
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 avoid performing MLE each time like does the above. My impression is that rolling from point t
2011 Mar 05
0
loess function takes long to estimate
Hi, I have 2 questions regarding using loess function in stats package. 1. I have about 1 million points. I did loess with alpha=0.5 and degree=1 and 2 regressors. It has run for more than 5 hrs on 64bit 16CPU and 64GB server (with no other process running). I am wondering if this is usual? And if there is anyway to make it run faster? 2. I noticed a difference in RAM consumption when specifying
2009 Oct 24
2
Implementation of gamma function for large number
Hi - I ran into a problem when the argument to gamma function is large. Says, if I do the following: > gamma(17000) [1] Inf Warning message: value out of range in 'gammafn' Is there anyway to get around this or other implementation? Thank you. -rc
2009 Oct 27
1
Poisson dpois value is too small for double precision thus corrupts loglikelihood
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 (> 20000). This causes dpois to returns 0 depending on values of theta1, theta2 and theta3. My first