Re: [R] R-help Digest, Vol 123, Issue 30

2013-05-27 Thread Neotropical bat risk assessments
Hi all are there any R packages that include circular stats similar to Oriana (http://www.kovcomp.co.uk/oriana/newver4.html)? I am interested in looking at annual patterns of bat activity where data will have date/times and relative abundance values for each Date. I would like to have a

Re: [R] Construct plot combination using grid without plotting and retrieving an object?

2013-05-27 Thread Paul Murrell
Hi On 05/24/13 20:24, Johannes Graumann wrote: Hi, I'm currently combining multiple plots using something along the lines of the following pseudo-code: library(grid) grid.newpage() tmpLayout - grid.layout( nrow=4, ncol=2) pushViewport(viewport(layout = tmpLayout)) and than

Re: [R] 3d interactive video using the rgl package

2013-05-27 Thread Xavier Hoenner
Hi Duncan, Thanks a lot for your response, that was very helpful. I've managed to get my head around the javascript code produced by the writeWebGL function: I now have a 4d interactive animation that can be played in a web browser. Let me know if you're interested in seeing it and I'll send

[R] configure ddply() to avoid reordering of '.variables'

2013-05-27 Thread Liviu Andronic
Hello, I'm using ddply() in plyr and I notice that it has the habit of re-ordering the levels of the '.variables' by which the splitting is done. I'm concerned about correctly retrieving the original ordering. Consider: require(plyr) x - iris[ order(iris$Species, decreasing=T), ] head(x) #

[R] Indexing within by statement - different coloured lines in abline wanted..

2013-05-27 Thread Tom Wilding
Dear R-list I'm trying to get each regression line, plotted using abline, to be of a different colour as the following code illustrates. I'm hoping there is a simple indexing solution. Many thanks. ## code from here colours=c(black,red,blue,green,pink)

[R] Classification of Multivariate Time Series

2013-05-27 Thread Lorenzo Isella
Dear All, Apologies for not posting a code snippet, but I really need a pointer about a methodology to look at my data and possibly some R package which can ease my task. I am given a set consisting of several multivariate noisy time series, let's call it {A}. Each A_i in {A}, in turn, consists of

[R] Time Series prediction

2013-05-27 Thread Giovanni Azua
Hello, I would like to use a parametric TS model and predictor as benchmark to compare against other ML methods I'm employing. I currently build a simple e.g. ARIMA model using the convenient auto.arima function like this: library(forecast) df - read.table(/Users/bravegag/data/myts.dat) # btw my

Re: [R] Classification of Multivariate Time Series

2013-05-27 Thread Emre Sahin
Did you have a look at Dynamic Time Warping and dtw package? Best, E. On Mon, May 27, 2013 at 01:34:42PM +0200, Lorenzo Isella wrote: Dear All, Apologies for not posting a code snippet, but I really need a pointer about a methodology to look at my data and possibly some R package which can

Re: [R] Indexing within by statement - different coloured lines in abline wanted..

2013-05-27 Thread John Kane
Slightly diffferent approach but will this do what you want. library(ggplot2) ggplot(Data1, aes(Predictor, Response1, colour = Site)) + geom_smooth(method= lm, se = FALSE) + ggtitle(Raw data with linear regresssions by Site) John Kane Kingston ON Canada -Original Message-

[R] metaMDS with large dataset produces 'insufficient data' warning

2013-05-27 Thread Raeanne Miller
Greetings everyone, I am running MDS on a very large dataset (12 x 25071 - 12 model runs with 25071 output values each), and also on a very much reduced version of the dataset (randomly select 1000 of the 25071 output values). I would like to look at similarities/dissimilarities between the 12

Re: [R] Indexing within by statement - different coloured lines in abline wanted..

2013-05-27 Thread Blaser Nello
abline(lm(Response1~Predictor,data=Site),col=colours[as.numeric(Site[1,1 ])]) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Tom Wilding Sent: Montag, 27. Mai 2013 12:40 To: r-help@r-project.org Subject: [R] Indexing within by

Re: [R] Classification of Multivariate Time Series

2013-05-27 Thread Roy Mendelssohn - NOAA Federal
Look at: State - Space Discrimination and Clustering of. Atmospheric Time Series Data. Based on Kullback Information Measures. Thomas Bengtsson If you Google the topic, there are host of other papers too, but the one meshes with exiting star-space methods. -Roy On May 27, 2013, at 4:34 AM,

Re: [R] configure ddply() to avoid reordering of '.variables'

2013-05-27 Thread arun
May be this helps levels(x$Species) #[1] setosa versicolor virginica x$Species- factor(x$Species,levels=unique(x$Species)) xa - ddply(x, .(Species), function(x)  {data.frame(Sepal.Length=x$Sepal.Length, mean.adj=(x$Sepal.Length -  mean(x$Sepal.Length)))})  head(xa) #    Species Sepal.Length

[R] Question about subsetting S4 object in ROCR

2013-05-27 Thread Guido Leoni
Dear list I'm testing a predictor and I produced nice performance plots with ROCR package utilizing the 3 standard command pred - prediction(predictions, labels) perf - performance(pred, measure = tpr, x.measure = fpr) plot(perf, col=rainbow(10)) The pred object and the perfo object are S4 with

Re: [R] configure ddply() to avoid reordering of '.variables'

2013-05-27 Thread arun
Also, you can check: http://stackoverflow.com/questions/7235421/how-to-ddply-without-sorting keeping.order - function(data, fn, ...) {   col - .sortColumn   data[,col] - 1:nrow(data)   out - fn(data, ...)   if (!col %in% colnames(out)) stop(Ordering column not preserved by function)   out -

[R] updating observations in lm

2013-05-27 Thread ivo welch
dear R experts---I would like to update OLS regressions with new observations on the front of the data, and delete some old observations from the rear. my goal is to have a flexible moving-window regression, with a minimum number of observations and a maximum number of observations. I can keep

[R] MLE for probit regression. How to avoid p=1 or p=0

2013-05-27 Thread knouri
Dear all: I am writing the following small function for a probit likelihood. As indicated, in order to avoid p=1 or p=0, I defined some precisions. I feel however, that there might be a better way to do this. Any help is greatly appreciated.

Re: [R] MLE for probit regression. How to avoid p=1 or p=0

2013-05-27 Thread Rui Barradas
Hello, You write a function of two arguments, 'par' and 'data' and do not use them in the body of the function. Furthermore, what are b0, b1x and y? Also, take a look at ?.Machine. In particular, couldn't you use precision0 - .Machine$double.eps precision1 - 1 - .Machine$double.eps instead

[R] Assistant

2013-05-27 Thread Adelabu Ahmmed
Dear Sir/Ma, I Adelabu.A.A, one of the R-users from Nigeria. I have a data-set of claims paid, premium for individual life-insurance policy holder but not in triangle form. how can i running stochastics chainladder in r on it. please help [[alternative HTML version deleted]]

[R] How sum all possible combinations of rows, given 4 matrices

2013-05-27 Thread Estigarribia, Bruno
Hello all, I have 4 matrices with 3 columns each (different number of rows though). I want to find a function that returns all possible 3-place vectors corresponding to the sum by columns of picking one row from matrix 1, one from matrix 2, one from matrix 3, and one from matrix 4. So basically,

[R] Stop on fail using data manipulation

2013-05-27 Thread Ala' Jaouni
Hello, I have a data set with test results for multiple devices (rows). I also have an index (column) that stores the first failing test for each device. I need to remove the results for all the tests that come after the first failing test. Example of a data table:

Re: [R] R-help Digest, Vol 123, Issue 30

2013-05-27 Thread Jim Lemon
On 05/27/2013 10:28 AM, Neotropical bat risk assessments wrote: Hi all are there any R packages that include circular stats similar to Oriana (http://www.kovcomp.co.uk/oriana/newver4.html)? I am interested in looking at annual patterns of bat activity where data will have date/times and

Re: [R] updating observations in lm

2013-05-27 Thread Bert Gunter
Ivo: 1. You should not be fitting linear models as you describe. For why not and how they should be fit, consult a suitable text on numerical methods (e.g. Givens and Hoeting). 2. In R, I suggest using lm() and ?update, feeding update() data modified as you like. This is, after all, the reason

Re: [R] How sum all possible combinations of rows, given 4 matrices

2013-05-27 Thread Bert Gunter
Homework? We don't do homework here. -- Bert On Mon, May 27, 2013 at 8:24 AM, Estigarribia, Bruno estig...@email.unc.edu wrote: Hello all, I have 4 matrices with 3 columns each (different number of rows though). I want to find a function that returns all possible 3-place vectors

Re: [R] How sum all possible combinations of rows, given 4 matrices

2013-05-27 Thread Jeff Newmiller
I expect the answer to involve manipulating indices. But why do you need to do this? This looks suspiciously like homework, and there is a no-homework policy on this list (see the Posting Guide). --- Jeff Newmiller

Re: [R] updating observations in lm

2013-05-27 Thread ivo welch
hi bert---thanks for the answer. my particular problem is well conditioned [stock returns] and speed is very important. about 4 years ago, I asked for speedier alternatives to lm (and you helped me on this one, too), and then checked into the speed/accuracy tradeoff.

Re: [R] Stop on fail using data manipulation

2013-05-27 Thread arun
I have a doubt about your New table especially the 3rd row: Since after test1 , the test fails, i guess 4,5 should  be NA dat1-read.table(text= Device,first_failing_test,test1,test2,test3,test4,test5 1,test2,1,2,3,4,5 2,test4,2,3,4,5,6 3,test1,3,4,5,6,7 ,sep=,,header=TRUE,stringsAsFactors=FALSE)

Re: [R] updating observations in lm

2013-05-27 Thread Bert Gunter
?lm.fit ## may be useful to you then. Have you tried it? -- Bert On Mon, May 27, 2013 at 9:52 AM, ivo welch ivo.we...@gmail.com wrote: hi bert---thanks for the answer. my particular problem is well conditioned [stock returns] and speed is very important. about 4 years ago, I asked for

Re: [R] Question about subsetting S4 object in ROCR

2013-05-27 Thread Uwe Ligges
On 27.05.2013 16:18, Guido Leoni wrote: Dear list I'm testing a predictor and I produced nice performance plots with ROCR package utilizing the 3 standard command pred - prediction(predictions, labels) perf - performance(pred, measure = tpr, x.measure = fpr) plot(perf, col=rainbow(10)) The

Re: [R] How sum all possible combinations of rows, given 4 matrices

2013-05-27 Thread arun
Hi, Not sure if this is what you expected: set.seed(24) mat1- matrix(sample(1:20,3*4,replace=TRUE),ncol=3) set.seed(28) mat2- matrix(sample(1:25,3*6,replace=TRUE),ncol=3) set.seed(30) mat3- matrix(sample(1:35,3*8,replace=TRUE),ncol=3) set.seed(35) mat4-

[R] How I can rearrange columns in data.frame?

2013-05-27 Thread Kristi Glover
Hi R-User, I am wondering how I can rearrange columns in a table in R. I do have very big data set (4500 columns). I have given an example of the data set. dput(dat) structure(list(preV1001A1b = c(0.59, 0.3, 0.78, 0.43), preV15A1b = c(0.57, 0.62, 0.51, 0.95), preV2032A1b = c(0.4, 0.8, 0.24,

Re: [R] How I can rearrange columns in data.frame?

2013-05-27 Thread Berend Hasselman
On 27-05-2013, at 20:17, Kristi Glover kristi.glo...@hotmail.com wrote: Hi R-User, I am wondering how I can rearrange columns in a table in R. I do have very big data set (4500 columns). I have given an example of the data set. dput(dat) structure(list(preV1001A1b = c(0.59, 0.3, 0.78,

Re: [R] How I can rearrange columns in data.frame?

2013-05-27 Thread peter dalgaard
On May 27, 2013, at 20:17 , Kristi Glover wrote: Hi R-User, I am wondering how I can rearrange columns in a table in R. I do have very big data set (4500 columns). I have given an example of the data set. dput(dat) structure(list(preV1001A1b = c(0.59, 0.3, 0.78, 0.43), preV15A1b =

Re: [R] How I can rearrange columns in data.frame?

2013-05-27 Thread arun
Hi, Try this: dat2-dat[order(as.numeric(gsub(preV(\\d+).*,\\1,colnames(dat]  dat2 #  preV15A1b preV59A1b preV1001A1b preV2032A1b preV2035A1b #1  0.57  0.05    0.59    0.40    0.95 #2  0.62  0.57    0.30    0.80    0.67 #3  0.51  0.03    0.78  

Re: [R] updating observations in lm

2013-05-27 Thread Greg Snow
Look at the biglm package. It does 2 of the 3 things that you asked for: Construct an initial lm fit and add a new block of data to update that fit. It does not remove data, but you may be able to look at the code and figure out a way to modify it to do the final piece. On Mon, May 27, 2013

Re: [R] updating observations in lm

2013-05-27 Thread Roger Koenker
The essential trick here is the Sherman-Morrison-Woodbury formula. My quantreg package has a lm.fit.recursive function that implements a fortran version for adding observations, but like biglm I don't remove observations at the other end either. Roger Koenker rkoen...@illinois.edu On May

Re: [R] updating observations in lm

2013-05-27 Thread Berend Hasselman
On 27-05-2013, at 17:12, ivo welch ivo.we...@anderson.ucla.edu wrote: dear R experts---I would like to update OLS regressions with new observations on the front of the data, and delete some old observations from the rear. my goal is to have a flexible moving-window regression, with a

Re: [R] choose the lines

2013-05-27 Thread arun
Hi, Try this: dat1- read.csv(dat7.csv,header=TRUE,stringsAsFactors=FALSE,sep=\t) dat.bru- dat1[!is.na(dat1$evnmt_brutal),] fun1- function(dat){          lst1- split(dat,dat$patient_id)     lst2- lapply(lst1,function(x) x[cumsum(x$evnmt_brutal==0)0,])     lst3- lapply(lst2,function(x)

Re: [R] updating observations in lm

2013-05-27 Thread ivo welch
Gentlemans as 274 algorithm allows weights, so adding an obs with a weight of -1 would do the trick of removing obs, too. This may be a good job for hadwell wickhams c code interface. On May 27, 2013 12:47 PM, Berend Hasselman b...@xs4all.nl wrote: On 27-05-2013, at 17:12, ivo welch

Re: [R] updating observations in lm

2013-05-27 Thread Berend Hasselman
On 27-05-2013, at 21:57, ivo welch ivo.we...@gmail.com wrote: Gentlemans as 274 algorithm allows weights, so adding an obs with a weight of -1 would do the trick of removing obs, too. This may be a good job for hadwell wickhams c code interface. Searching for Gentlemans as 274 algorithm

[R] Bayes Logit and Cholesky Decomposition

2013-05-27 Thread Tjun Kiat Teo
I am trying to use the package Bayes Logit and I keep getting this error message. chol2inv(chol(P1.j)) : error in evaluating the argument 'x' in selecting a method for function 'chol2inv': Error in chol.default(P1.j) : the leading minor of order 5 is not positive definite I can't see why

Re: [R] Assistant

2013-05-27 Thread Jim Lemon
On 05/28/2013 12:22 AM, Adelabu Ahmmed wrote: Dear Sir/Ma, I Adelabu.A.A, one of the R-users from Nigeria. I have a data-set of claims paid, premium for individual life-insurance policy holder but not in triangle form. how can i running stochastics chainladder in r on it. please help

[R] Data reshaping

2013-05-27 Thread Christofer Bogaso
Hello again, let say I have following data-frame: Dat - data.frame(c(rep(c(A, B), each = 4), C, C, C), c(rep(1:4, 2), 1, 2, 3), 11:21) colnames(Dat) - c(X1, X2, X3) Dat X1 X2 X3 1 A 1 11 2 A 2 12 3 A 3 13 4 A 4 14 5 B 1 15 6 B 2 16 7 B 3 17 8 B 4 18 9 C 1 19 10 C

Re: [R] Data reshaping

2013-05-27 Thread arun
res1- xtabs(X3~X1+X2,data=Dat) res1 #   X2 #X1   1  2  3  4  # A 11 12 13 14  # B 15 16 17 18  # C 19 20 21  0 library(reshape2)  dcast(Dat,X1~X2,value.var=X3) #  X1  1  2  3  4 #1  A 11 12 13 14 #2  B 15 16 17 18 #3  C 19 20 21 NA A.K. Hello again, let say I have following data-frame: Dat -

Re: [R] Plot histograms in a loop

2013-05-27 Thread arun
Hi, Try either: set.seed(28) stats1- as.data.frame(matrix(rnorm(5*1),ncol=5)) pdf(paste(test,1,.pdf,sep=)) par(mfrow=c(2,1)) lst1- lapply(names(stats1),function(i) {hist(stats1[,i],100,col=lightblue,main=paste0(Histogram of ,i),xlab=i );qqnorm(stats1[,i])}) dev.off() #or

[R] fitting grid-based models

2013-05-27 Thread Javier Rodríguez Pérez
Hello! I'm interested to fit parameters (to data) in a grid-based (individual) model. If I understood well, simecol library has the fitOdeModel function but it is only suited to odeModels (differential equation). Alternatively, FME package has several functions able to perform this procedure but

Re: [R] Data reshaping

2013-05-27 Thread Duncan Mackay
library(reshape2) dcast(Dat, X1 ~X2, value.var = X3) X1 1 2 3 4 1 A 11 12 13 14 2 B 15 16 17 18 3 C 19 20 21 NA or use ? reshape HTH Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...@northnet.com.au At

[R] p values of plor

2013-05-27 Thread meng
Hi all: As to the polr {MASS} function, how to find out p values of every parameter? From the example of R help: house.plr - polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) summary(house.plr) How to find out the p values of house.plr? Many thanks. Best.

Re: [R] p values of plor

2013-05-27 Thread David Winsemius
On May 27, 2013, at 7:59 PM, meng wrote: Hi all: As to the polr {MASS} function, how to find out p values of every parameter? From the example of R help: house.plr - polr(Sat ~ Infl + Type + Cont, weights = Freq, data = housing) summary(house.plr) How to find out the p values of