Re: [R] PLS in R

2017-12-06 Thread Bjørn-Helge Mevik
Margarida Soares writes: > library(pls) > plsrcue<- plsr(cue~fb+cn+n+ph+fung+bact+resp, data = cue, ncomp=7, > na.action = NULL, method = "kernelpls", scale=FALSE, validation = "LOO", > model = TRUE, x = FALSE, y = FALSE) > summary(plsrcue) > > and I got this output, where I think I can choose th

Re: [R] parallel computing with foreach()

2017-12-06 Thread Peter Langfelder
Your code generates an error that has nothing to do with dopar. I have no idea what your function stack is supposed to do; you may be inadvertently calling utils::stack which would produce this kind of error: > stack(1:25, RAT = FALSE) Error in data.frame(values = unlist(unname(x)), ind, stringsAs

[R] parallel computing with foreach()

2017-12-06 Thread Kumar Mainali
I have used foreach() for parallel computing but in the current problem, it is not working. Given the volume and type of the data involved in the analysis, I will try to give below the complete code without reproducible example. In short, each R environment will draw a set of separate files, perfo

Re: [R] Remove

2017-12-06 Thread David Winsemius
> On Dec 6, 2017, at 4:27 PM, Ashta wrote: > > Thank you Ista! Worked fine. Here's another (possibly more direct in its logic?): DM[ !ave(DM$x, DM$GR, FUN= function(x) {!length(unique(x))==1}), ] GR x y 5 B 25 321 6 B 25 512 7 B 25 123 8 B 25 451 -- David > On Wed, Dec 6, 2017 at

Re: [R] Remove

2017-12-06 Thread Ashta
Thank you Ista! Worked fine. On Wed, Dec 6, 2017 at 5:59 PM, Ista Zahn wrote: > Hi Ashta, > > There are many ways to do it. Here is one: > > vars <- sapply(split(DM$x, DM$GR), var) > DM[DM$GR %in% names(vars[vars > 0]), ] > > Best > Ista > > On Wed, Dec 6, 2017 at 6:58 PM, Ashta wrote: >> Thank

Re: [R] Remove

2017-12-06 Thread Ista Zahn
Hi Ashta, There are many ways to do it. Here is one: vars <- sapply(split(DM$x, DM$GR), var) DM[DM$GR %in% names(vars[vars > 0]), ] Best Ista On Wed, Dec 6, 2017 at 6:58 PM, Ashta wrote: > Thank you Jeff, > > subset( DM, "B" != x ), this works if I know the group only. > But if I don't know th

Re: [R] Remove

2017-12-06 Thread Ashta
Thank you Jeff, subset( DM, "B" != x ), this works if I know the group only. But if I don't know that group in this case "B", how do I identify group(s) that all elements of x have the same value? On Wed, Dec 6, 2017 at 5:48 PM, Jeff Newmiller wrote: > subset( DM, "B" != x ) > > This is covered

Re: [R] Remove

2017-12-06 Thread Jeff Newmiller
subset( DM, "B" != x ) This is covered in the Introduction to R document that comes with R. -- Sent from my phone. Please excuse my brevity. On December 6, 2017 3:21:12 PM PST, David Winsemius wrote: > >> On Dec 6, 2017, at 3:15 PM, Ashta wrote: >> >> Hi all, >> In a data set I have group(GR

Re: [R] Remove

2017-12-06 Thread Ashta
Thank you David. This will not work. Tthis removes only duplicate records. DM[ !duplicated(DM$x) , ] My goal is to remove the group if all elements of x in that group have the same value. On Wed, Dec 6, 2017 at 5:21 PM, David Winsemius wrote: > >> On Dec 6, 2017, at 3:15 PM, Ashta wrote: >>

Re: [R] Remove

2017-12-06 Thread David Winsemius
> On Dec 6, 2017, at 3:15 PM, Ashta wrote: > > Hi all, > In a data set I have group(GR) and two variables x and y. I want to > remove a group that have the same record for the x variable in each > row. > > DM <- read.table( text='GR x y > A 25 125 > A 23 135 > A 14 145 > A 12 230 > B 25 321

[R] Remove

2017-12-06 Thread Ashta
Hi all, In a data set I have group(GR) and two variables x and y. I want to remove a group that have the same record for the x variable in each row. DM <- read.table( text='GR x y A 25 125 A 23 135 A 14 145 A 12 230 B 25 321 B 25 512 B 25 123 B 25 451 C 11 521 C 14 235 C 15 258 C 10 654',heade

Re: [R] Coeficients estimation in a repeated measures linear model

2017-12-06 Thread Jim Lemon
Hi Sergio, You seem to be aiming for a univariate repeated measures analysis. Maybe this will help: subno<-rep(1:6,2) dat <- data.frame(subno=rep(1:6,2),,vals = c(ctrl, ttd), cond = c(rep("ctrl", 6), rep("ttd", 6)), ind = factor(rep(1:6, 2))) fit<-aov(vals~ind+cond+Error(subno),data=dat) fit su

Re: [R] Odd dates generated in Forecasts

2017-12-06 Thread David Winsemius
> On Dec 6, 2017, at 11:09 AM, Paul Bernal wrote: > > Thank you very much David. As a matter of fact, I solved it by doing the > following: > > MyTimeSeriesObj <- ts(MyData, freq=365.25/7, > start=decimal_date(mdy("01-04-2003"))) > > After doing that adjustment, my forecasts dates started fr

Re: [R] Odd dates generated in Forecasts

2017-12-06 Thread Paul Bernal
Thank you very much David. As a matter of fact, I solved it by doing the following: MyTimeSeriesObj <- ts(MyData, freq=365.25/7, start=decimal_date(mdy("01-04-2003"))) After doing that adjustment, my forecasts dates started from 2017 on. Cheers, Paul 2017-12-06 12:03 GMT-05:00 David Winsemius

Re: [R] Coeficients estimation in a repeated measures linear model

2017-12-06 Thread Bert Gunter
Sergio: 1. You do not have a "repeated measures linear model" . 2. This list is not designed to replace your own efforts to learn the necessary R background, in this case, factor coding and contrasts in linear models. I would suggest you spend some time with any of the many fine R linear model tu

Re: [R] Odd dates generated in Forecasts

2017-12-06 Thread David Winsemius
> On Dec 6, 2017, at 5:07 AM, Paul Bernal wrote: > > Dear friends, > > I have a weekly time series which starts on Jan 4th, 2003 and ends on > december 31st, 2016. > > I set up my ts object as follows: > > MyTseries <- ts(mydataset, start=2003, end=2016, frequency=52) > > MyModel <- auto.ari

[R] Coeficients estimation in a repeated measures linear model

2017-12-06 Thread Sergio PV
Dear Users, I am trying to understand the inner workings of a repeated measures linear model. Take for example a situation with 6 individuals sampled twice for two conditions (control and treated). set.seed(12) ctrl <- rnorm(n = 6, mean = 2) ttd <- rnorm(n = 6, mean = 10) dat <- data.frame(vals =

[R] Odd dates generated in Forecasts

2017-12-06 Thread Paul Bernal
Dear friends, I have a weekly time series which starts on Jan 4th, 2003 and ends on december 31st, 2016. I set up my ts object as follows: MyTseries <- ts(mydataset, start=2003, end=2016, frequency=52) MyModel <- auto.arima(MyTseries, d=1, D=1) MyModelForecast <- forecast (MyModel, h=12) Sinc