Re: [R] maximum-likelihood-estimation with mle()

2015-09-12 Thread Ben Bolker
peter dalgaard  gmail.com> writes:

> 
> You are being over-optimistic with your starting values, and/or 
> with constrains on the parameter space. 
> Your fit is diverging in sigma for some reason known
>  only to nonlinear-optimizer gurus...
> 
> For me, it works either to put in an explicit
>  constraint or to reparametrize with log(sigma).

  [snip]

  Another few strategies:

set.seed(101)
x <- 1:10
y <- 3*x - 1 + rnorm(length(x), mean=0, sd=0.5)

library("stats4")
nLL <- function(a, b, sigma) {
  -sum(dnorm(y, mean=a*x+b, sd=sigma, log=TRUE))
}

fit <- mle(nLL, start=list(a=0, b=0, sigma=1), nobs=length(y))


   Nelder-Mead is generally more robust than BFGS, although slower:


fit2 <- mle(nLL, start=list(a=0, b=0, sigma=1),
 method="Nelder-Mead",nobs=length(y))

   bbmle can be used to simplify things slightly (this repeats
Peter Dalgaard's transformation of sigma):

library("bbmle")
fit3 <- mle2(y~dnorm(mean=mu,sd=exp(logsigma)),
   parameters=list(mu~x),
   data=data.frame(x,y),
   start=list(mu=0, logsigma=0))

  You can also profile out the sigma:

## dnorm with sd profiled out
dnorm2 <- function(x,mean,log=FALSE) {
  ssq <- sum((x-mean)^2)
  dnorm(x,mean,sd=sqrt(ssq/length(x)),log=log)
}
fit4 <- mle2(y~dnorm2(mean=mu),
   parameters=list(mu~x),
   data=data.frame(x,y),
   start=list(mu=0))

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] removing outlier

2015-09-12 Thread David Winsemius

On Sep 12, 2015, at 2:32 AM, Juli wrote:

> Hi Jim, 
> 
> thank you for your help. :)
> 
> My point is, that there are outlier and I don´t really know how to deal with
> that. 
> 
> I need the dataframe for a regression and read often that only a few outlier
> can change your results very much. In addition, regression diacnostics
> didn´t indcate me the best results.
> Yes, and I know its not the core of statistics to work in a way you get
> results you would like to have ;).
> 
> So what is your suggestion?
> 
> And if I remove the outliers, my problem ist, that as you said, they differ
> in length. I need the data frame for a regression, so can I remove the whole
> column or is there a call to exclude the data?

Most regression methods have a 'subset' parameter which would allow you to 
distort the data to your desired specification. But why not think about 
examining a different statistical model or using robust methods? That way you 
can keep all your data. (Sounds like you don't really have a lot.)

-- 
David.
> 
> JULI
> 
> 
> 
> --
> View this message in context: 
> http://r.789695.n4.nabble.com/removing-outlier-tp4712137p4712170.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

David Winsemius
Alameda, CA, USA

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R-es] para una pequeña orientación

2015-09-12 Thread heber sarmiento via R-help-es
Cordial saludo a todos:
Estoy realizando un script en el que se deben leer algunos datos, para esto he 
escrito el siguiente códigocat("introducir los datos:")x<-scan()cat("los datos 
introducidos son",x,"\n")

los problemas que tengo son en esencia dos.
Previo a esto debo dar algunas instrucciones en cuanto a los datos, esto es 
debo ofrecer al usuario algunas indicaciones por escrito, lo que no se es si R 
cuenta con alguna instrucción diferente de cat() y print() que me permita 
escribir texto en bloque, esto, para no tener que hacerlo línea por lines. 
Lo segundo es 
que quiero que los valores que se han introducido me salgan en bloque, es decir 
ordenados por filas y/o columnas; lo intente escribir como una columna pero no 
funciono bien, sobre todo cuando el número de datos es impar por la cuestión 
del número de elementos por fila.
Agradezco cualquier orientación al respecto.
Un abrazo fraternal y de gratitud a todos.


[[alternative HTML version deleted]]

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


Re: [R] For logical i and length(i) > length(x), x[i] <- value makes length(x) == length(i)

2015-09-12 Thread Suharto Anggono Suharto Anggono via R-help
I'll make my points clearer.

- The case of logical index vector longer than the original vector is not usual 
case for me. As I said, I encountered it in the code of function 'rank' in R.

- Before, I have read "S-PLUS help" (version 3.4, it seems), 
http://www.uni-muenster.de/ZIV.BennoSueselbeck/s-html/helpfiles/Subscript.html. 
The following is the relevant part. There are missing pieces there that I fill 
by guessing.

Vector subscripts are generated with when i and x are both vectors. () The 
result of the expression is to extract or replace elements of x corresponding 
to a vector of positive indices computed according to the value of i.

 If i is logical the indices are produced by starting at 1 and selecting 
the numbers for which the corresponding element is T. If is shorter than it is 
extended by cyclic repetition. It can be longer than as well, with no change in 
the computation of indices. 



For replacements, x[i] <- value the rule is that the length of will be set to 
the largest value in the indices, if that is bigger than the current length of 
x. 


>From it, I infer that, if i is logical and length(i) >= length(x), x[i] <- 
>value has the same effect to x[which(i)] <- value, where which(i) takes 
>indices where i is T.

- In R, if i is logical and length(i) > length(x), length(x) after x[i] <- 
value may be different from after x[which(i)] <- value.

- So, I wonder if R inherits the behavior from S or not.

- The behavior is not clearly documented in R. I just find "R Language 
Definition", "3.4.1 Indexing by vectors", that can be interpreted to imply the 
behavior.

- However, for a particular case, function 'rank' in R relies on the behavior.

However, it seems that relying on the behavior is not on purpose. Previously, 
at least until R 3.1.3, the code of function 'rank' has the following before yy 
<- NA .
yy <- integer(length(x))
storage.mode(yy) <- storage.mode(y)

It seems that yy[] <- NA is what is intended.

- However, for me, the behavior is plausible. The assumption is that indices 
from 1 to length(i) exist.

--

I think this behavior is consistent with typical indexing behaviour in R... I 
would ask you what result you thought you should get? I, for one, can think of 
all sorts of uses for numeric indexes that have different lengths than the 
vector, but am stumped to think of any use for what you are proposing. 
---
Jeff NewmillerThe .   .  Go Live...
DCN:<[hidden email]>Basics: ##.#.   ##.#.  Live Go... 
  Live:   OO#.. Dead: OO#..  Playing 
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with 
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity. 

On September 5, 2015 10:02:05 AM PDT, Suharto Anggono Suharto Anggono via 
R-help <[hidden email]> wrote: 

>I came across this behavior when I followed the code of function 'rank' 
>in R. 
> 
>It seems that subassignment of a vector by a logical index vector that 
>is longer than the original vector always results in expanding the 
>original vector to the length of the index vector. 
> 
>The resulting length may be different from the result of subassignment 
>by the equivalent numeric vector. For subassignment of a vector by a 
>numeric index vector, the original vector is expanded to the maximum 
>index, if it is larger than the length of the original vector. 
> 
>This is an example. 
> 
>> x <- NA 
>> x[c(FALSE,TRUE,FALSE)] <- 1 
>> x 
>[1] NA  1 NA 
> 
>Compare to this. 
> 
>> x <- NA 
>> x[which(c(FALSE,TRUE,FALSE))] <- 1 
>> x 
>[1] NA  1 
> 
>Does S exhibit the same behavior? 
> 
>Currently, if there is NA and na.last = "keep", function 'rank' in R 
>relies on this behavior to give correct result length. 
> 
>In "R Language Definition", "3.4.1 Indexing by vectors" says: "Logical. 
>The indexing i should generally have the same length as x.  If it 
>is longer, then x is conceptually extended with NAs. " The 
>statement can be taught to support the observed behavior. 
> 
>> sessionInfo() 
>R version 3.2.2 (2015-08-14) 
>Platform: i386-w64-mingw32/i386 (32-bit) 
>Running under: Windows XP (build 2600) Service Pack 2 
> 
>locale: 
>[1] LC_COLLATE=English_United States.1252 
>[2] LC_CTYPE=English_United States.1252 
>[3] LC_MONETARY=English_United States.1252 
>[4] LC_NUMERIC=C 
>[5] LC_TIME=English_United States.1252 
> 
>attached base packages: 
>[1] stats graphics  grDevices utils datasets  methods   base 
> 
>__ 
>[hidden email] mailing list -- To UNSUBSCRIBE and more, see 
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide 

Re: [R] Adding a second Y axis on a dotplot

2015-09-12 Thread Duncan Mackay

I forgot to put a line about latticeExtra's doubleYScale
library(latticeExtra)
? doubleYScale
Duncan


-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Duncan
Mackay
Sent: Sunday, 13 September 2015 00:56
To: R
Subject: Re: [R] Adding a second Y axis on a dotplot

Hi

see https://stat.ethz.ch/pipermail/r-help/2007-June/134524.html

to get you started. Its toolate or too early here

Regards

Duncan 

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of li li
Sent: Saturday, 12 September 2015 03:30
To: r-help
Subject: [R] Adding a second Y axis on a dotplot

Hi all,
  I plotted a dotplot based on the data below and code below. I would
like to add another yaxis on the right with a different col, different
tickmarks and a different label. Can anyone give some help?Thanks very
much!!
 Hanna


> tmp1
   result  lot  trt trtsymb trtcol
1  98 lot1 trt1   1   blue
2  99 lot2 trt1   1   blue
3  98 lot3 trt1   1   blue
4 100 lot4 trt1   1   blue
5 100 lot5 trt1   1   blue
6 101 lot6 trt1   1   blue
7 101 lot7 trt1   1   blue
8  99 lot8 trt1   1   blue
9 100 lot9 trt1   1   blue
10 94 lot1 trt2  16red
11105 lot2 trt2  16red
12 87 lot3 trt2  16red
13119 lot4 trt2  16red
14 96 lot5 trt2  16red
15113 lot6 trt2  16red
16106 lot7 trt2  16red
17 71 lot8 trt2  16red
18 95 lot9 trt2  16red


library(lattice)
dotplot(result ~ lot, tmp1, cex=1.1,  ylab = "values", xlab="lot",
jitter.y = F, aspect=1.0,
pch=tmp1$trtsymb, col=tmp1$trtcol, scales=list(rot=30),
main="", key = list(text = list(labels = c("trt1", "trt2"),cex=c(0.9,0.9)),
points = list(pch =c(1,12), col =c("blue", "red")),
space = "right"))

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] R CRAN check works great on local Mac OS, but failed on Windows (win-builder web). Why?

2015-09-12 Thread yazeng
I have my R package checked on local Mac OS via R CMD check --as-cran.
Everything works great: no errors, no warnings, just 1 note about first
submission, all test files passed! However, when I submit my .tar.gz package
file to the http://win-builder.r-project.org to check on Windows. Some
errors occurred when running the examples.

The main issue is related to the object created by Matrix. All errors
indicated 

*invalid class "dgCMatrix" object: Dimnames[1] is not a character vector.
*

Detailed check log is attached below. I checked the examples on local
machine line-by-line, but cannot identify the problem.

Is the error caused by that maybe the Matrix package was written differently
for Mac OS and Windows platforms?

/* checking examples ...
** running examples for arch 'i386' ... ERROR
Running examples in 'grpregOverlap-Ex.R' failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: cv.grpregOverlap
> ### Title: Cross-validation for choosing regularization parameter lambda
> ### Aliases: cv.grpregOverlap
> 
> ### ** Examples
> 
> ## linear regression, a simulation demo.
> set.seed(123)
> group <- list(gr1 = c(1, 2, 3),
+   gr2 = c(1, 4),
+   gr3 = c(2, 4, 5),
+   gr4 = c(3, 5),
+   gr5 = c(6))
> beta.latent.T <- c(5, 5, 5, 0, 0, 0, 0, 0, 5, 5, 0) # true latent
> coefficients.
> # beta.T <- c(5, 5, 10, 0, 5, 0), true variables: 1, 2, 3, 5; true groups:
> 1, 4.
> X <- matrix(rnorm(n = 6*100), ncol = 6)
> X.latent <- expandX(X, group)
Error in validObject(.Object) : 
  invalid class "dgCMatrix" object: Dimnames[1] is not a character vector
Calls: expandX ... initialize -> callNextMethod -> .nextMethod ->
validObject
Execution halted/


*I also attached source code for the two related functions.*


/expandX <- function(X, group) {
  incidence.mat <- incidenceMatrix(X, group) # group membership incidence
matrix
  over.mat <- Matrix(incidence.mat %*% t(incidence.mat), sparse = TRUE, 
 dimnames = dimnames(incidence.mat)) # overlap matrix
  grp.vec <- rep(1:nrow(over.mat), times = diag(over.mat)) # group index
vector

  # expand X to X.latent
  X.latent <- NULL
  names <- NULL

  ## the following code will automatically remove variables not included in
'group'
  for(i in 1:nrow(incidence.mat)) {
idx <- incidence.mat[i,]==1
X.latent <- cbind(X.latent, X[, idx, drop=FALSE])
names <- c(names, colnames(incidence.mat)[idx])
  }
  colnames(X.latent) <- paste('grp', grp.vec, '_', names, sep = "")
  X.latent
}

incidenceMatrix <- function(X, group) {
  n <- nrow(X)
  p <- ncol(X)
  if (class(group) != 'list') {
stop("Argument 'group' must be a list of integer indices or character
names of variables!")
  }
  J <- length(group)
  grp.mat <- Matrix(0, nrow = J, ncol = p, dimnames=list(rep(NA, J),
 rep(NA, p)))
  if(is.null(colnames(X))) {
colnames(X) <- paste("V", 1:ncol(X), sep="")
  }
  if (is.null(names(group))) {
names(group) <- paste("grp", 1:J, sep="")
  }

  if (class(group[[1]]) == 'numeric') {
for (i in 1:J) {
  ind <- group[[i]]
  grp.mat[i, ind] <- 1
  colnames(grp.mat)[ind] <- colnames(X)[ind]
}
  } else { ## character, names of variables
for (i in 1:J) {
  grp.i <- as.character(group[[i]])
  ind <- colnames(X) %in% grp.i
  grp.mat[i, ] <- 1*ind
  colnames(grp.mat)[ind] <- colnames(X)[ind]
}
  }
  rownames(grp.mat) <- as.character(names(group))
  # check grp.mat
  if (all(grp.mat == 0)) {
stop("The names of variables in X don't match with names in group!")
  }

  grp.mat
}
/



--
View this message in context: 
http://r.789695.n4.nabble.com/R-CRAN-check-works-great-on-local-Mac-OS-but-failed-on-Windows-win-builder-web-Why-tp4712179.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] For logical i and length(i) > length(x), x[i] <- value makes length(x) == length(i)

2015-09-12 Thread William Dunlap
Splus 8.2.0 (c. 2010) and Splus6.0 (c. 2001) act like R in this respect.
  x <- c(10.0, 11.0, 12.0)
  i <- c(FALSE,TRUE,FALSE,FALSE,TRUE)
  x[i]
  #[1] 11 NA
  x[i] <- 1:2
  x
  #[1] 10  1 12 NA  2
I no longer have access to a running version of Splus 3.4, but it does not
look like a feature we would have changed.

Bill Dunlap
TIBCO Software
wdunlap tibco.com


On Sat, Sep 12, 2015 at 9:17 AM, Suharto Anggono Suharto Anggono via
R-help  wrote:
> I'll make my points clearer.
>
> - The case of logical index vector longer than the original vector is not 
> usual case for me. As I said, I encountered it in the code of function 'rank' 
> in R.
>
> - Before, I have read "S-PLUS help" (version 3.4, it seems), 
> http://www.uni-muenster.de/ZIV.BennoSueselbeck/s-html/helpfiles/Subscript.html.
>  The following is the relevant part. There are missing pieces there that I 
> fill by guessing.
>
> Vector subscripts are generated with when i and x are both vectors. () 
> The result of the expression is to extract or replace elements of x 
> corresponding to a vector of positive indices computed according to the value 
> of i.
>
>  If i is logical the indices are produced by starting at 1 and selecting 
> the numbers for which the corresponding element is T. If is shorter than it 
> is extended by cyclic repetition. It can be longer than as well, with no 
> change in the computation of indices. 
>
> 
>
> For replacements, x[i] <- value the rule is that the length of will be set to 
> the largest value in the indices, if that is bigger than the current length 
> of x. 
>
>
> >From it, I infer that, if i is logical and length(i) >= length(x), x[i] <- 
> >value has the same effect to x[which(i)] <- value, where which(i) takes 
> >indices where i is T.
>
> - In R, if i is logical and length(i) > length(x), length(x) after x[i] <- 
> value may be different from after x[which(i)] <- value.
>
> - So, I wonder if R inherits the behavior from S or not.
>
> - The behavior is not clearly documented in R. I just find "R Language 
> Definition", "3.4.1 Indexing by vectors", that can be interpreted to imply 
> the behavior.
>
> - However, for a particular case, function 'rank' in R relies on the behavior.
>
> However, it seems that relying on the behavior is not on purpose. Previously, 
> at least until R 3.1.3, the code of function 'rank' has the following before 
> yy <- NA .
> yy <- integer(length(x))
> storage.mode(yy) <- storage.mode(y)
>
> It seems that yy[] <- NA is what is intended.
>
> - However, for me, the behavior is plausible. The assumption is that indices 
> from 1 to length(i) exist.
>
> --
>
> I think this behavior is consistent with typical indexing behaviour in R... I 
> would ask you what result you thought you should get? I, for one, can think 
> of all sorts of uses for numeric indexes that have different lengths than the 
> vector, but am stumped to think of any use for what you are proposing.
> ---
> Jeff NewmillerThe .   .  Go Live...
> DCN:<[hidden email]>Basics: ##.#.   ##.#.  Live Go...
>   Live:   OO#.. Dead: OO#..  Playing
> Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
> /Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
> ---
> Sent from my phone. Please excuse my brevity.
>
> On September 5, 2015 10:02:05 AM PDT, Suharto Anggono Suharto Anggono via 
> R-help <[hidden email]> wrote:
>
>>I came across this behavior when I followed the code of function 'rank'
>>in R.
>>
>>It seems that subassignment of a vector by a logical index vector that
>>is longer than the original vector always results in expanding the
>>original vector to the length of the index vector.
>>
>>The resulting length may be different from the result of subassignment
>>by the equivalent numeric vector. For subassignment of a vector by a
>>numeric index vector, the original vector is expanded to the maximum
>>index, if it is larger than the length of the original vector.
>>
>>This is an example.
>>
>>> x <- NA
>>> x[c(FALSE,TRUE,FALSE)] <- 1
>>> x
>>[1] NA  1 NA
>>
>>Compare to this.
>>
>>> x <- NA
>>> x[which(c(FALSE,TRUE,FALSE))] <- 1
>>> x
>>[1] NA  1
>>
>>Does S exhibit the same behavior?
>>
>>Currently, if there is NA and na.last = "keep", function 'rank' in R
>>relies on this behavior to give correct result length.
>>
>>In "R Language Definition", "3.4.1 Indexing by vectors" says: "Logical.
>>The indexing i should generally have the same length as x.  If it
>>is longer, then x is conceptually extended with NAs. " The
>>statement can be taught to support the observed behavior.
>>
>>> sessionInfo()
>>R version 3.2.2 (2015-08-14)
>>Platform: 

[R] Wavelets Forecast/Prediction

2015-09-12 Thread Diego Ubuntu
Is there any way to forecast/predict a time series using wavelets ? Is
there any package with that functionality included?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Installation R package Rssa from directory

2015-09-12 Thread Jeff Newmiller
Looks to me like you are giving the name of a directory where a file name of a 
tar.gz (package source) would be required. R prefers to be given the package 
file rather than an extracted directory of files.

Most packages on Windows are used in their binary form ("zip" file), so you 
would not specify the type="source" option of you install from the zip file.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On September 11, 2015 1:22:56 PM PDT, tonina  wrote:
>Hello. I'm trying to install R package Rssa from directory
>install.packages("d:\\Rssa\\", repos=NULL, type="source")
>
>But I have an error
>
>* installing *binary* package 'Rssa' ...
>Warning: running command 'cp -R . "E:/Program
>Files/R/R-3.1.3/library/Rssa"
>|| ( tar cd - .| (cd "E:/Program Files/R/R-3.1.3/library/Rssa" && tar
>-xf -
>))' had status 127
>ERROR: installing binary package failed
>* removing 'E:/Program Files/R/R-3.1.3/library/Rssa'
>Warning in install.packages :
>  running command '"E:/PROGRA~1/R/R-31~1.3/bin/x64/R" CMD INSTALL -l 
>"E:\Program Files\R\R-3.1.3\library" "d:/Rssa/"' had status 1
>Warning in install.packages :
> installation of package ‘d:/Rssa/’ had non-zero exit status
>I installed this packages early from directory without problem. And
>when I
>use this package without installation
>
>library("Rssa", lib.loc="d:\\Rssa\\")
>
>package works now too.
>
>I have been looking for similar errors, but I still can not understand
>this
>error and don't know what to do. Thank you for help.
>
>
>
>--
>View this message in context:
>http://r.789695.n4.nabble.com/Installation-R-package-Rssa-from-directory-tp4712160.html
>Sent from the R help mailing list archive at Nabble.com.
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] kendall tau distance

2015-09-12 Thread Ragia Ibrahim
many thanks for replying.
 I have the vectors
 running the code

ConDisPairs( data.frame(c(1,2,3,4,5),c(3,4,1,2,5)) ) 

$pi.c
     [,1] [,2]
[1,]   12    0
[2,]    8    1
[3,]    7    3
[4,]    5    6
[5,]    0   10

$pi.d
     [,1] [,2]
[1,]    0   14
[2,]    3   12
[3,]    7    9
[4,]    8    5
[5,]   10    0

$C
[1] 69

$D
[1] 109


I could not find the result related to the result at wiki page in any 
way..looking for 4 ? dissimilar pairs?

many thanks


> From: dcarl...@tamu.edu
> To: ragi...@hotmail.com; r-help@r-project.org
> Subject: RE: [R] kendall tau distance
> Date: Fri, 11 Sep 2015 15:37:19 +
>
> The Wikipedia article gives a simple formula based on the number of 
> discordant pairs. You can get that from the ConDisPairs() function in package 
> DescTools.
>
> -
> David L Carlson
> Department of Anthropology
> Texas A University
> College Station, TX 77840-4352
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ragia Ibrahim
> Sent: Thursday, September 10, 2015 12:40 PM
> To: r-help@r-project.org
> Subject: [R] kendall tau distance
>
> Dear group
> how to calculate kendall tau distance according to Kendall_tau_distance at 
> wikipedia
>
>  href="httpsen.wikipedia.orgwikiKendall_tau_distance" 
> target="_blank" 
> class="newlyinsertedlink">httpsen.wikipedia.orgwikiKendall_tau_distance
>
>
> thanks in advance
> Ragia
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
  
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] help

2015-09-12 Thread Ghada Almousa
hi

In cluster analysis K-means , hirarical cluster ,DBSCAN and EM how do we
calculate purity

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] removing outlier

2015-09-12 Thread Juli
Hi Jim, 

thank you for your help. :)

My point is, that there are outlier and I don´t really know how to deal with
that. 

I need the dataframe for a regression and read often that only a few outlier
can change your results very much. In addition, regression diacnostics
didn´t indcate me the best results.
Yes, and I know its not the core of statistics to work in a way you get
results you would like to have ;).

So what is your suggestion?

And if I remove the outliers, my problem ist, that as you said, they differ
in length. I need the data frame for a regression, so can I remove the whole
column or is there a call to exclude the data?

JULI



--
View this message in context: 
http://r.789695.n4.nabble.com/removing-outlier-tp4712137p4712170.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Re: [R] Installation R package Rssa from directory

2015-09-12 Thread tonina
Many thanks, Jeff!
I install package with
install.packages('d:\\Rssa\\Rssa_0.13.zip', repos=NULL)



--
View this message in context: 
http://r.789695.n4.nabble.com/Installation-R-package-Rssa-from-directory-tp4712160p4712174.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Wavelets Forecast/Prediction

2015-09-12 Thread Bert Gunter
(internet) search!

e.g. on "R package wavelets"

There are several. See also the time series task view on CRAN.

-- Bert




Bert Gunter

"Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom."
   -- Clifford Stoll


On Fri, Sep 11, 2015 at 10:58 PM, Diego Ubuntu  wrote:
> Is there any way to forecast/predict a time series using wavelets ? Is
> there any package with that functionality included?
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Adding a second Y axis on a dotplot

2015-09-12 Thread Duncan Mackay
Hi

see https://stat.ethz.ch/pipermail/r-help/2007-June/134524.html

to get you started. Its toolate or too early here

Regards

Duncan 

Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home: mac...@northnet.com.au

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of li li
Sent: Saturday, 12 September 2015 03:30
To: r-help
Subject: [R] Adding a second Y axis on a dotplot

Hi all,
  I plotted a dotplot based on the data below and code below. I would
like to add another yaxis on the right with a different col, different
tickmarks and a different label. Can anyone give some help?Thanks very
much!!
 Hanna


> tmp1
   result  lot  trt trtsymb trtcol
1  98 lot1 trt1   1   blue
2  99 lot2 trt1   1   blue
3  98 lot3 trt1   1   blue
4 100 lot4 trt1   1   blue
5 100 lot5 trt1   1   blue
6 101 lot6 trt1   1   blue
7 101 lot7 trt1   1   blue
8  99 lot8 trt1   1   blue
9 100 lot9 trt1   1   blue
10 94 lot1 trt2  16red
11105 lot2 trt2  16red
12 87 lot3 trt2  16red
13119 lot4 trt2  16red
14 96 lot5 trt2  16red
15113 lot6 trt2  16red
16106 lot7 trt2  16red
17 71 lot8 trt2  16red
18 95 lot9 trt2  16red


library(lattice)
dotplot(result ~ lot, tmp1, cex=1.1,  ylab = "values", xlab="lot",
jitter.y = F, aspect=1.0,
pch=tmp1$trtsymb, col=tmp1$trtcol, scales=list(rot=30),
main="", key = list(text = list(labels = c("trt1", "trt2"),cex=c(0.9,0.9)),
points = list(pch =c(1,12), col =c("blue", "red")),
space = "right"))

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.