Re: [R] how can I count data points outside the main plot line?

2016-03-30 Thread PIKAL Petr
Hi Raz Keep your responses to the rhelp list. Did you try residuals function? DNase1 <- subset(DNase, Run == 1) DNase1[12,3]<-0.1 fm1DNase1 <- nls(density ~ SSlogis(log(conc), Asym, xmid, scal), DNase1) resid(fm1DNase1) [1] -3.273213e-02 -3.173213e-02 -7.798226e-03 -4.798226e-03 -7.665433e-05 [6

Re: [R] Filtering based on the occurrence

2016-03-30 Thread Jim Lemon
Hi Farnoosh, Despite my deep suspicion that this answer will solve a useless problem, try this: last_subject<-0 keep_deps<-c("B","D","F") keep_rows<-NULL for(rowindex in 1:dim(df)[1]) { if(df[rowindex,"Subject"] != last_subject) { last_subject<-df[rowindex,"Subject"] start_keeping<-0 } if(d

Re: [R] Filtering based on the occurrence

2016-03-30 Thread Giorgio Garziano
# your code Subject<- c("2", "2", "2", "3", "3", "3", "4", "4", "5", "5", "5", "5") dates <- seq(as.Date('2011-01-01'),as.Date('2011-01-12'), by = 1) deps <- c("A", "B", "C", "C", "D", "A", "F", "G", "A", "F", "A", "D") df <- data.frame(Subject, dates, deps) df final<-c("2 2011-01-02B","2 2011

Re: [R] Convergence issues when using ns splines (pkg: spline) in Cox model (coxph) even when changing coxph.control

2016-03-30 Thread Göran Broström
Hi Jennifer, see below. On 2016-03-29 22:47, Jennifer Wu, Miss wrote: Hi, I am currently using R v3.2.3 and on Windows 10 OS 64Bit. I am having convergence issues when I use coxph with a interaction term (glarg*bca_py) and interaction term with the restricted cubic spline (glarg*bca_time_ns).

Re: [R] Compute the Gini coefficient

2016-03-30 Thread Erich Neuwirth
> On 30 Mar 2016, at 02:53, Marine Regis wrote: > > Hello, > > I would like to build a Lorenz curve and calculate a Gini coefficient in > order to find how much parasites does the top 20% most infected hosts support. > > Here is my data set: > > Number of parasites per host: > parasites = c(

Re: [R] Compute the Gini coefficient

2016-03-30 Thread Achim Zeileis
On Wed, 30 Mar 2016, Erich Neuwirth wrote: On 30 Mar 2016, at 02:53, Marine Regis wrote: Hello, I would like to build a Lorenz curve and calculate a Gini coefficient in order to find how much parasites does the top 20% most infected hosts support. Here is my data set: Number of parasites

Re: [R] convergence issues with coxph

2016-03-30 Thread Therneau, Terry M., Ph.D.
Failure to converge in a coxph model is very rare. If the program does not make it in 20 iterations it likely will never converge, so your control argument will do little. Without the data set I have no way to guess what is happening. My first question, however, is to ask how many events you

[R] ts or xts with high-frequency data within a year

2016-03-30 Thread Ryan Utz
Hello, I have a time series that represents data sampled every 15-minutes. The data currently run from November through February, 8623 total readings. There are definitely daily periodic trends and non-stationary long-term trends. I would love to decompose this using basic time series analysis. H

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread Bert Gunter
Code please. Reproducible example?(e.g. 1st 100 values) "PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code." Bert Gunter "The trouble with having an open mind is that people keep coming along and sticki

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread Bert Gunter
I "think" the problem is that you failed to set the "frequency" attribute of your time series, so it defaults to 1. A time series with one observation per period cannot be decomposed, since the error term is confounded with the "seasonality", which is essentially your error message. Again, a guess

Re: [R] installing packages

2016-03-30 Thread James Henson
To All, Thanks for your help. I uninstalled R, the 3.2 library and R Studio. Reinstalled R and R Studio. Now the temp files move the newly installed packages into the R-.23.2.4revised library. > .libPaths() [1] "C:/Users/james_henson/Desktop/Documents/R/win-library/3.2" [2] "C:/Program Files/R/R

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread Joshua Ulrich
On Wed, Mar 30, 2016 at 10:29 AM, Bert Gunter wrote: > I "think" the problem is that you failed to set the "frequency" > attribute of your time series, so it defaults to 1. A time series with > one observation per period cannot be decomposed, since the error term > is confounded with the "seasonal

[R] ts or xts with high-frequency data within a year

2016-03-30 Thread Ryan Utz
Sorry about not providing code; I didn't think to just simulate dummy code. Here's a situation where I have <1 year of data, hourly time sampling, and the error that I get using my actual data: ### X=as.data.frame(1:6000) X[2]=seq.POSIXt(ISOdate(2015,11,1),by='hour',length.out=6000) X[3]=sample(

[R] difficult to find index value

2016-03-30 Thread Rubel Das via R-help
 Dear R group memberI tried couple of hours to figure out the solution of following.match function behaves strange from value 0.7 and 1.7 > periodlimint<-seq(from=0.1, to=50, by=0.1)> indexAtest<-match( .6, > periodlimint)> indexAtest[1] 6> periodlimint<-seq(from=0.1, to=50, by=0.1)> > indexAte

[R] Problems with pooling Multiply Imuputed datasets, of a multilevel logistic model, using (MICE)

2016-03-30 Thread Jonathan Halls via R-help
I am having problems with the MICE package in R, particularity with pooling the imputed data sets. I am running a multilevel binomial logistic regression, with Level1 - topic (participant response to 10 questions on different topics, e.g. T_Darkness, T_Day) nested within Level2 - individuals. T

[R] Multinomial mixed models with glmmADMB

2016-03-30 Thread Ana María Prieto
Dear r-helpers, I want to run a multinomial mixed effects model with the glmmADMB package of R. I have read the available information of the programm but i couldn't find which family or link has to be used for multinomial data. In the examples are only shown models with Poisson, negative binomial

Re: [R] fftImg() error: fftw_access_func

2016-03-30 Thread Eric Handler
Took me a few days to get a reply from the student. The code he is running is: library(ripa) img<-readJPEG( "arthurs-seat.jpg" ) hist(fftImg(img)) I see the same error as the student on many systems. When I run require(ripa) on the machine I mentioned before: > require('ripa') Loading required

Re: [R] R logo size in package information tab of Rstudio

2016-03-30 Thread Duncan Murdoch
On 29/03/2016 3:42 PM, Marc Girondot via R-help wrote: Two different sizes of R logo are shown in Rstudio in the Help at the package level. For example, numderiv shows a nice discreet logo located at (in MacosX): /Library/Frameworks/R.framework/Versions/3.3/Resources/doc/html/logo.jpg whereas pa

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread William Dunlap via R-help
You said you specified frequency=96 when you constructed the time series, but when I do that the decomposition looks reasonable: > time <- seq(0,9,by=1/96) # 15-minute intervals, assuming time unit is day > measurement <- sqrt(time) + 1/(1.2+sin(time*2*pi)) + rnorm(length(time),0,.3) > plot(decomp

Re: [R] difficult to find index value

2016-03-30 Thread Ista Zahn
FAQ 7.31 I think. Here are a couple things you can try. close_enough <- function(x, y) isTRUE(all.equal(x, y)) periodlimint<-seq(from=0.1, to=50, by=0.1) indexAtest <- which(sapply(periodlimint, close_enough, y = 0.7)) match( as.character(.7), periodlimint) Best, Ista On Wed, Mar 30, 2016 at

Re: [R] Accented characters, windows

2016-03-30 Thread Jan Kacaba
Duncun, thank you for your reply. My encoding is: > Sys.getlocale('LC_CTYPE') [1] "Czech_Czech Republic.1250" In RStudio I use UTF-8. I tried also other recommended encodings but some characters are still misrepresented. I've found solution to this. To correctly display strings in RStudio I have

[R] Bagging Question

2016-03-30 Thread Majid Javanmard
Hello here is the code implements bagging that I copied from net ( http://www.r-bloggers.com/improve-predictive-performance-in-r-with-bagging/) : set.seed(10) y<-c(1:1000) x1<-c(1:1000)*runif(1000,min=0,max=2) x2<-c(1:1000)*runif(1000,min=0,max=2) x3<-c(1:1000)*runif(1000,min=0,max=2) lm_fit<-l

Re: [R] Convergence issues when using ns splines (pkg: spline) in Cox model (coxph) even when changing coxph.control

2016-03-30 Thread David Winsemius
> On Mar 29, 2016, at 1:47 PM, Jennifer Wu, Miss > wrote: > > Hi, > > I am currently using R v3.2.3 and on Windows 10 OS 64Bit. > > I am having convergence issues when I use coxph with a interaction term > (glarg*bca_py) and interaction term with the restricted cubic spline > (glarg*bca_tim

[R] Boosting Algorithm for Regression (Adaboost.R2)

2016-03-30 Thread Majid Javanmard
Hello I am new to R , Is there any code to run Adaboost.R2 in r ?! I wrote a code from example of gbm package, but I can not have prediction interval would you help me ?! library(gbm) mm <- read.table("E:/bagg.txt",TRUE) xnam <- paste("x", 1:50, sep="") fmla <- as.formula(paste("y ~ ", paste(xna

Re: [R] Boosting Algorithm for Regression (Adaboost.R2)

2016-03-30 Thread Bert Gunter
https://cran.r-project.org/web/views/MachineLearning.html What do you mean by Prediction Interval? I doubt that this has clear meaning in the boosting context. You might want to follow up this statistical question on a statistical or machine learning list like stats.stackexchange.com . Bert Gun

Re: [R] Convergence issues when using ns splines (pkg: spline) in Cox model (coxph) even when changing coxph.control

2016-03-30 Thread Göran Broström
On 2016-03-30 23:06, David Winsemius wrote: On Mar 29, 2016, at 1:47 PM, Jennifer Wu, Miss wrote: Hi, I am currently using R v3.2.3 and on Windows 10 OS 64Bit. I am having convergence issues when I use coxph with a interaction term (glarg*bca_py) and interaction term with the restricted c

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread Ryan Utz
Bill, Josh, and Bert, Thanks for your responses. I still can't quite get this when I use actual dates. Here's an example of what is going wrong: X=as.data.frame(1:6000) X[2]=seq.POSIXt(ISOdate(2015,11,1),by='hour',length.out=6000) X[3]=sample(100,size=6000,replace=T) Y=xts(X[,3],order.by=X[,2])

[R] R how to find outliers and zero mean columns?

2016-03-30 Thread Norman Pat
Hi team I am new to R so please help me to do this task. Please find the attached data sample. But in the original data frame I have 350 features and 40 observations. I need to carryout these tasks. 1. How to Identify features (names) that have all zeros? 2. How to remove features that ha

Re: [R] R how to find outliers and zero mean columns?

2016-03-30 Thread David Winsemius
> On Mar 30, 2016, at 3:56 PM, Norman Pat wrote: > > Hi team > > I am new to R so please help me to do this task. > > Please find the attached data sample. No. Nothing attached. Please read the Rhelp Info page and the Posting Guide. > But in the original data frame I > have 350 features and

Re: [R] R how to find outliers and zero mean columns?

2016-03-30 Thread Jordan Meyer
I strongly suggest checking out some R tutorials. Most of these tasks are basic data management that are likely covered in just about any tutorial. I'm afraid that this isn't the appropriate forum for such basics. On Mar 30, 2016 9:14 PM, "Norman Pat" wrote: > Hi team > > I am new to R so please

Re: [R] R how to find outliers and zero mean columns?

2016-03-30 Thread Jim Lemon
Hi Norman, To check whether all values of an object (say "x") fulfill a certain condition (==0): all(x==0) If your object (X) is indeed a data frame, you can only do this by column, so if you want to get the results: X<-data.frame(A=c(0,1:10),B=c(0,2:10,9), C=c(0,-1,3:11),D=rep(0,11)) all_z

Re: [R] ts or xts with high-frequency data within a year

2016-03-30 Thread William Dunlap via R-help
decompose wants frequency(Y) to be more than 1 - it really wants an integer frequency so it can return a vector of that length containing the repeating pattern (the "figure"). frequency(Y) is 1/3600 so you get the error (which might be better worded): > plot(decompose(Y)) Error in decompose(Y

Re: [R] R how to find outliers and zero mean columns?

2016-03-30 Thread Jim Lemon
How about: # if a data frame names(X)[which_cols] # and if you have rownames: rownames(X)[which_rows] My note about hackles was that packages generally don't know what values are "abnormal" unless you specify them. Just like us. So you have to specify what the range of "normal" values are, or wh

Re: [R] R how to find outliers and zero mean columns?

2016-03-30 Thread Norman Pat
Hi David, > Please find the attached data sample. No. Nothing attached. Please read the Rhelp Info page and the Posting Guide. *I attached it. Anyway I have attached it again (sample train.xlsx).* Who is assigning you this task? Homework? (Read the Posting Guide.) *This is my new job role so I

Re: [R] R how to find outliers and zero mean columns?

2016-03-30 Thread Norman Pat
Hi Jim, Thanks for your reply. I know these basic stuffs in R. But I want to know let say you have a data frame X with 300 features. >From that 300 features I need to pullout the names of each feature that has zero values for all the observations in that sample. Here I am looking for a packag

Re: [R] R how to find outliers and zero mean columns?

2016-03-30 Thread David Winsemius
> On Mar 30, 2016, at 6:39 PM, Norman Pat wrote: > > Hi David, > > > Please find the attached data sample. > > No. Nothing attached. Please read the Rhelp Info page and the Posting Guide. > I attached it. Anyway I have attached it again (sample train.xlsx). I didn't say you didn't attach it.

Re: [R] R how to find outliers and zero mean columns?

2016-03-30 Thread Jim Lemon
Perhaps if you go back to the example that I sent, you will notice that those vectors of logical values (which_cols, which_rows) were among the results. Have you tried: names(X)[which_cols] to see whether it is what you want? Jim On Thu, Mar 31, 2016 at 2:42 PM, Norman Pat wrote: > Hi Jim, > >