Re: [R] geoRglm with factor variable as covariable

2012-10-07 Thread Filoche
Thank you Ruben.

You were absolutly right. I'm using trend option now to specify my model. 

Thank for the help,
Phil



--
View this message in context: 
http://r.789695.n4.nabble.com/geoRglm-with-factor-variable-as-covariable-tp4645067p4645310.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] two indirect effects of path analysis

2012-10-07 Thread yrosseel

On 10/07/2012 02:17 AM, Elaine Kuo wrote:

Hello,

This is Elaine.

I am trying a path analysis using lavaan Package.

There are three explanatory variables: X, Z, and M.
The response variable is Y.
A, b, and c have direct effects on Y.

On the other hand, X and Z also have direct effects on M.
In other words, X and Z have indirect effects on Y.

I found the code example of lavaan package describes only one indirect
effect as below.
Please kindly advise how to modify it as two indirect effects.


You need to write down all the regressions that are involved in your 
model. For each 'dependent' variable, there is a regression formula:


model - '
Y ~ X + Z + M
M ~ X + Z
'

Optionally, you can label the parameters, and define some indirect effects:

model - '
Y ~ c1*X + c2*Z + b*M
M ~ a1*X + a2*Z

ab1 := a1*b
ab2 := a2*b

totalx := ab1 + c1
totalz := ab2 + c2
'

Hope this helps,

Yves.

__
R-help@r-project.org mailing list
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] vector is not assigned correctly in for loop

2012-10-07 Thread 周果
Thank you all for helping me out.
As Michael points out, I abused the rounding and formatting of print()
while debugging.
The default number of digits to print is 7 according to ?print.default,
which makes floating point numbers to be somewhat plausible for index vector
subsetting at first glance:
--
 print(0.0001)
[1] 1e-12
 print(0.)
[1] 1
--
However, since ?[ mentioned that numerics are coerced to integers in fact, it
turns out to be an floating point issue.
As Berend and Rui noted, it can be revealed by:
--
 print(0.0001, digits = 17)
[1] 9.9998e-13
 print(formatC(0.0001, format=f, 17))
[1] 0.00010
 print(0., digits = 17)
[1] 0.2
 print(formatC(0., format=f, 17))
[1] 0.2
--
As we can see above, floating point number is a miracle, and there is still
some magic with print(). :)
BTW, I think this is a general issue, which should be carefully considered
regardless of R or other languages.
Have a nice day.

Cheers,
Guo

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Test for Random Points on a Sphere

2012-10-07 Thread 周果
Hi Lorenzo,

Just a quick thought, the uniform probability density on a unit sphere is 1
/ (4pi),
what about binning those random points according to their directions and do
a chi-square test?

Regards,
Guo

On Sun, Oct 7, 2012 at 2:16 AM, cbe...@tajo.ucsd.edu wrote:

 Lorenzo Isella lorenzo.ise...@gmail.com writes:

  Dear All,
  I implemented an algorithm for (uniform) random rotations.
  In order to test it, I can apply it to a unit vector (0,0,1) in
  Cartesian coordinates.
  The result is supposed to be a set of random, uniformly distributed,
  points on a sphere (not the point of the algorithm, but a way to test
  it).
  This is what the points look like when I plot them, but other then
  eyeballing them, can anyone suggest a test to ensure that I am really
  generating uniform random points on a sphere?

 There is a substantial literature on this topic and more than one
 (metaphorical?) direction you could follow.

 I suggest you Google 'directional statistics' and start reading.

 Visit http://www.rseek.org and enter 'directional statistics' in
 the search box and click on the search button to see if there is
 something in R to meet your needs.

 A post to r-sig-geo might get more helpful responses once you can focus
 the question a bit more.


 HTH,

 Chuck

  Many thanks
 
  Lorenzo
 

 --
 Charles C. BerryDept of Family/Preventive
 Medicine
 cberry at ucsd edu  UC San Diego
 http://famprevmed.ucsd.edu/faculty/cberry/  La Jolla, San Diego 92093-0901

 __
 R-help@r-project.org mailing list
 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.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] get: problem with environments

2012-10-07 Thread Martin Ivanov
 Dear R users,

I am running R-2.15.1 in Linux Slackware64-14.0. Here is my minimal working 
example:

testfun - function (x) {
 a - 0;
 sapply(X=a, FUN=get, envir=sys.frame(which=x));
}

Inside R, that is R called from within a Linux terminal, the following code 
works:
testfun(x=5)
print(testfun(x=6))
But within rkward the above code fails and the following works:
testfun(x=1)
print(testfun(x=2))

As you can see, the number of contexts up the call stack that contain the 
variable a
varies depending on the implementation. If I call testfun() from within 
print(), I have to go 
one context up the call stack than if I call testfun() alone by itself. This 
implies 
some inherent instability of my code. 

Actually I need to provide get() access to the calling environment of sapply().
According to the documentation of parent.frame(), The parent frame of a 
function evaluation is the environment in which the function was called. I 
tried to use parent.frame() instead of sys.frame() above,
but the variable a is never found, regardless of what value I give to the 
parameter n of 
parent.frame().

I have basically three questions:

1. Do You have an idea how I could implement the code 
more stably, so that the variable a is always visible to get, regardless of 
whether testfun
is used alone by itself or called from within another function?

2. Why does the implementation with parent.frame() not work?

3. Why does the number of contexts in the call stack differ in R and in rkward? 
It seems that when R is called from within the Linux terminal the call stack 
contains 4 contexts more that it does when is called from rkward. This also 
points to the instability of the code which I would like to solve.

Any suggestions on any on the above questions will be greatly appreciated.

Best regards,

Martin

__
R-help@r-project.org mailing list
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] get: problem with environments

2012-10-07 Thread R. Michael Weylandt
On Sun, Oct 7, 2012 at 10:16 AM, Martin Ivanov tra...@abv.bg wrote:
  Dear R users,

 I am running R-2.15.1 in Linux Slackware64-14.0. Here is my minimal working 
 example:

 testfun - function (x) {
  a - 0;
  sapply(X=a, FUN=get, envir=sys.frame(which=x));
 }

 Inside R, that is R called from within a Linux terminal, the following code 
 works:
 testfun(x=5)
 print(testfun(x=6))
 But within rkward the above code fails and the following works:
 testfun(x=1)
 print(testfun(x=2))

 As you can see, the number of contexts up the call stack that contain the 
 variable a
 varies depending on the implementation. If I call testfun() from within 
 print(), I have to go
 one context up the call stack than if I call testfun() alone by itself. This 
 implies
 some inherent instability of my code.

Unlike you, I don't get testfun(x = 5) to work in a terminal emulator.
As expected, I only get x =1 and print(... x = 2) to work and I just
tried this with R 2.15.0 and R devel, both in Terminal and by way of
ESS.  It could be a buglet introduced later into the 2.15 branch, but
that seems unlikely. As expected,

 testfun(5)
 Error in sys.frame(which = x) : not that many frames on the stack

Can someone else confirm the behavior you see?

Cheers,
Michael

__
R-help@r-project.org mailing list
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] get: problem with environments

2012-10-07 Thread Rui Barradas

Hello,

No, I can't confirm the behavior the op sees.
I've tried it in an R terminal on ubuntu 12.04, rkward on ubuntu, and 
RGui on Windows 7. R version 2.15.1.


Here's the rkward sessionInfo.

sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=pt_PT.UTF-8  LC_NUMERIC=C
 [3] LC_TIME=pt_PT.UTF-8   LC_COLLATE=pt_PT.UTF-8
 [5] LC_MONETARY=pt_PT.UTF-8   LC_MESSAGES=pt_PT.UTF-8
 [7] LC_PAPER=pt_PT.UTF-8  LC_NAME=pt_PT.UTF-8
 [9] LC_ADDRESS=pt_PT.UTF-8LC_TELEPHONE=pt_PT.UTF-8
[11] LC_MEASUREMENT=pt_PT.UTF-8LC_IDENTIFICATION=pt_PT.UTF-8

attached base packages:
[1] stats graphics  grDevices utils datasets  methods base

other attached packages:
[1] rkward_0.5.6

loaded via a namespace (and not attached):
[1] tools_2.15.1

Rui Barradas

Em 07-10-2012 10:34, R. Michael Weylandt escreveu:

On Sun, Oct 7, 2012 at 10:16 AM, Martin Ivanov tra...@abv.bg wrote:

  Dear R users,

I am running R-2.15.1 in Linux Slackware64-14.0. Here is my minimal working 
example:

testfun - function (x) {
  a - 0;
  sapply(X=a, FUN=get, envir=sys.frame(which=x));
}

Inside R, that is R called from within a Linux terminal, the following code 
works:
testfun(x=5)
print(testfun(x=6))
But within rkward the above code fails and the following works:
testfun(x=1)
print(testfun(x=2))

As you can see, the number of contexts up the call stack that contain the variable 
a
varies depending on the implementation. If I call testfun() from within 
print(), I have to go
one context up the call stack than if I call testfun() alone by itself. This 
implies
some inherent instability of my code.

Unlike you, I don't get testfun(x = 5) to work in a terminal emulator.
As expected, I only get x =1 and print(... x = 2) to work and I just
tried this with R 2.15.0 and R devel, both in Terminal and by way of
ESS.  It could be a buglet introduced later into the 2.15 branch, but
that seems unlikely. As expected,


testfun(5)

  Error in sys.frame(which = x) : not that many frames on the stack

Can someone else confirm the behavior you see?

Cheers,
Michael

__
R-help@r-project.org mailing list
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
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] get: problem with environments

2012-10-07 Thread arun
Hi,

I am getting the same error message as Michael got (R terminal (R 2.15) on 
Ubuntu 12.04).


  testfun(x=5)
#Error in sys.frame(which = x) : not that many frames on the stack
 print(testfun(x=6))
#Error in sys.frame(which = x) : not that many frames on the stack

A.K.

- Original Message -
From: R. Michael Weylandt michael.weyla...@gmail.com
To: Martin Ivanov tra...@abv.bg
Cc: r-help@r-project.org
Sent: Sunday, October 7, 2012 5:34 AM
Subject: Re: [R] get: problem with environments

On Sun, Oct 7, 2012 at 10:16 AM, Martin Ivanov tra...@abv.bg wrote:
  Dear R users,

 I am running R-2.15.1 in Linux Slackware64-14.0. Here is my minimal working 
 example:

 testfun - function (x) {
  a - 0;
  sapply(X=a, FUN=get, envir=sys.frame(which=x));
 }

 Inside R, that is R called from within a Linux terminal, the following code 
 works:
 testfun(x=5)
 print(testfun(x=6))
 But within rkward the above code fails and the following works:
 testfun(x=1)
 print(testfun(x=2))

 As you can see, the number of contexts up the call stack that contain the 
 variable a
 varies depending on the implementation. If I call testfun() from within 
 print(), I have to go
 one context up the call stack than if I call testfun() alone by itself. This 
 implies
 some inherent instability of my code.

Unlike you, I don't get testfun(x = 5) to work in a terminal emulator.
As expected, I only get x =1 and print(... x = 2) to work and I just
tried this with R 2.15.0 and R devel, both in Terminal and by way of
ESS.  It could be a buglet introduced later into the 2.15 branch, but
that seems unlikely. As expected,

 testfun(5)
Error in sys.frame(which = x) : not that many frames on the stack

Can someone else confirm the behavior you see?

Cheers,
Michael

__
R-help@r-project.org mailing list
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
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] (no subject)

2012-10-07 Thread Rui Barradas

Hello,

You must install the appropriate package(s). Try, for instance,

install.packages('rugarch')  # do this only once


And then, every time you start an R session, if you want to use it,

library(rugarch)  # do this every R session


To know more, try

help('rugarch')
vignette(package = 'rugarch')
vignette('Introduction_to_the_rugarch_package', package = 'rugarch')


The first 'vignette' instruction gives you a list of available 
vignettes, the second one opens the vignette file in a new window.


Hope this helps,

Rui Barradas

Em 07-10-2012 11:05, mina izadi escreveu:

Dear r-helper
I am pleased to send you this email. I have the R 2.11.1 and R 2.15.1
versions but they dose't have GARCH models. May you please guide me in
which version can i find GARCH models.
Best.
M.Izadi

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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
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] Computing for Data Analysis ~ R

2012-10-07 Thread Brigettebrenda
Do to work schedules, I may have to  discontinue.
 
I really like this course and wish to finish. When is this course offered  
again, and if so, can I take again?
 
Or, do we have to submit my even the hard deadlines? I can continue if we  
do not have to submit even by the hard deadline.
 
I am the type of person, I have to understand what I am doing, but just  
memorizing and then performing.
 
Thanks,
 
Dr. Brenda Nelson-Porter
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] get: problem with environments

2012-10-07 Thread R. Michael Weylandt
On Sun, Oct 7, 2012 at 12:33 PM, Rui Barradas ruipbarra...@sapo.pt wrote:
 Hello,

 No, I can't confirm the behavior the op sees.
 I've tried it in an R terminal on ubuntu 12.04, rkward on ubuntu, and RGui
 on Windows 7. R version 2.15.1.

 Here's the rkward sessionInfo.

 sessionInfo()
 R version 2.15.1 (2012-06-22)
 Platform: x86_64-pc-linux-gnu (64-bit)

On Sun, Oct 7, 2012 at 1:28 PM, arun smartpink...@yahoo.com wrote:
 I am getting the same error message as Michael got (R terminal (R 2.15) on 
 Ubuntu 12.04).

   testfun(x=5)
 #Error in sys.frame(which = x) : not that many frames on the stack
  print(testfun(x=6))
 #Error in sys.frame(which = x) : not that many frames on the stack


From: R. Michael Weylandt michael.weyla...@gmail.com
 To: Martin Ivanov tra...@abv.bg
 Cc: r-help@r-project.org
 Sent: Sunday, October 7, 2012 5:34 AM
 Subject: Re: [R] get: problem with environments

 On Sun, Oct 7, 2012 at 10:16 AM, Martin Ivanov tra...@abv.bg wrote:
  Dear R users,

 I am running R-2.15.1 in Linux Slackware64-14.0. Here is my minimal working 
 example:

 testfun - function (x) {
  a - 0;
  sapply(X=a, FUN=get, envir=sys.frame(which=x));
 }

 Inside R, that is R called from within a Linux terminal, the following code 
 works:
 testfun(x=5)
 print(testfun(x=6))
 But within rkward the above code fails and the following works:
 testfun(x=1)
 print(testfun(x=2))

 As you can see, the number of contexts up the call stack that contain the 
 variable a
 varies depending on the implementation. If I call testfun() from within 
 print(), I have to go
 one context up the call stack than if I call testfun() alone by itself. This 
 implies
 some inherent instability of my code.

 Unlike you, I don't get testfun(x = 5) to work in a terminal emulator.
 As expected, I only get x =1 and print(... x = 2) to work and I just
 tried this with R 2.15.0 and R devel, both in Terminal and by way of
 ESS.  It could be a buglet introduced later into the 2.15 branch, but
 that seems unlikely. As expected,

 testfun(5)
 Error in sys.frame(which = x) : not that many frames on the stack


So this all suggests something very strange has happened to your
setup, Martin. Does this persist after a new session (perhaps running
as R --vanilla) and/or reinstall?

To your original questions:

 1. Do You have an idea how I could implement the code
 more stably, so that the variable a is always visible to get, regardless of 
 whether testfun
 is used alone by itself or called from within another function?

Well, you can do it without get() and just trust in the scoping rules
to make it work. Depending on your application, this might simplify
the code nicely.

If you really do need to compute something on the fly, tricks like
eval(parse(text = )), as.name(), call() etc might work, but they're
occasionally difficult to get right.

a - 54
eval(as.name(a)) + 2

testfun2 - function(n, letter) eval(as.name(letter)) + n

testfun2(3, a) # 57


 2. Why does the implementation with parent.frame() not work?

You didn't show us how you tried to use parent.frame()


 3. Why does the number of contexts in the call stack differ in R and in 
 rkward?

It shouldn't. This is an issue that needs further sorting out.

Cheers,
Michael

__
R-help@r-project.org mailing list
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] Presence/ absence data from matrix to single column

2012-10-07 Thread agoijman
The problem with that, is that I just wrote an example of my database, but I
have around 250 species and more than 500 sites. In the approach you show
me, it looks like I have to enter every species name and sites individually,
right?



--
View this message in context: 
http://r.789695.n4.nabble.com/Presence-absence-data-from-matrix-to-single-column-tp4645271p4645331.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] a merge() problem

2012-10-07 Thread Sam Steingold
I know it does not look very good - using the same column names to mean
different things in different data frames, but here you go:
--8---cut here---start-8---
 x - data.frame(a=c(1,2,3),b=c(4,5,6))
 y - data.frame(b=c(1,2),a=c(a,b))
 merge(x,y,by.x=a,by.y=b,all.x=TRUE,suffixes=c(,y))
  a ba
1 1 4a
2 2 5b
3 3 6 NA
Warning message:
In merge.data.frame(x, y, by.x = a, by.y = b, all.x = TRUE) :
  column name 'a' is duplicated in the result
--8---cut here---end---8---
why is the suffixes argument ignored?
I mean, I expected that the second a to be a.y.
(when I omit suffixes, the result is the same).
Thanks.
-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://palestinefacts.org http://honestreporting.com
http://truepeace.org http://openvotingconsortium.org
My name is Deja Vu. Have we met before?

__
R-help@r-project.org mailing list
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] Problem with national characters in main, xlab, ylab with pdf{grDevices} / postscript {grDevices}

2012-10-07 Thread Magdalena A. Tkacz
Hello.

I'm trying to make some graphics with nationalized labels (pdf for use
in LaTeX document).


On console (displayed on screen) using  all looks ok:
\/
data-rnorm(100)
hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
ylab='Częstość występowania')
---/\

But using:
---\/
data-rnorm(100)

pdf('plik.pdf',encoding=CP1250.enc)
hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
ylab='Częstość występowania')
dev.off()
/\

It does not look fine ...

Without specifying encoding:
---\/
pdf('plik-wo-enc.pdf')
hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
ylab='Częstość występowania')
dev.off()
-/\
Almost does not have national characters. (Almost, because ó letter appears)

Exemplary pdf file are here:
https://www.drivehq.com/file/df.aspx/shareID10318887/fileID1167942261/plik.pdf
https://www.drivehq.com/file/df.aspx/shareID10318887/fileID1167945977/plik-wo-enc.pdf


I have read Non-Standard Fonts in PostScript and PDF Graphics by
Paul Murrell and Brian Ripley in Rnews.

I have also tried option with
---\/
Sys.setlocale(category=LC_CTYPE, locale=pl_PL.utf8)
---/\
but even in admin (run R as admin) in Win7 I received warning:
---\/
In Sys.setlocale(category = LC_CTYPE, locale = pl_PL.utf8) :
Żądania raportów OS aby ustawić lokalizację na pl_PL.utf8 nie mogą
zostać wykonane
---/\
(translated in short : OS report request to set locale to pl_PL.utf8
can not be done)


Does anyone knows how to obtain pdf documents with acceptable quality?



Thanks in advance,

Regards

-- 
/|/| _ _ _/_ /_   _  /  / _ __
/   |(/(/(/(/((-/)(/ (  /((/( /_
 _/
Magdalena Tkacz

__
R-help@r-project.org mailing list
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] get: problem with environments

2012-10-07 Thread Martin Ivanov
 Thank You very much for Your replies.
Dear Michael,

Does this persist after a new session (perhaps running as R --vanilla) and/or 
reinstall?
Yes, it does. After running R --vanilla, still there are 4 contexts more on the 
call stack.
 
You didn't show us how you tried to use parent.frame()
I did it like this:
testfun1 - function (x1) {
 a1 - 1;
 sapply(X=a1, FUN=get, envir=parent.frame(x1));
}

testfun1(x1=1);

The above code never succeeds no matter what a number I give to x1.

 3. Why does the number of contexts in the call stack differ in R and in 
rkward?
 It shouldn't. This is an issue that needs further sorting out.

Here is some more info on my setup:
sessionInfo()   
R version 2.15.1 (2012-06-22)
Platform: x86_64-slackware-linux-gnu (64-bit)

locale:
 [1] LC_CTYPE=en_US   LC_NUMERIC=C LC_TIME=en_US   
 [4] LC_COLLATE=C LC_MONETARY=en_USLC_MESSAGES=en_US   
 [7] LC_PAPER=C   LC_NAME=CLC_ADDRESS=C
[10] LC_TELEPHONE=C   LC_MEASUREMENT=en_US LC_IDENTIFICATION=C 

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base 

loaded via a namespace (and not attached):
[1] tools_2.15.1


Best regards,

Martin

__
R-help@r-project.org mailing list
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] Computing for Data Analysis ~ R

2012-10-07 Thread David Winsemius
This is not the mailing list for any course.

-- 

On Oct 7, 2012, at 12:27 AM, brigettebre...@aol.com wrote:

 Do to work schedules, I may have to  discontinue.
 
 I really like this course and wish to finish. When is this course offered  
 again, and if so, can I take again?
 
 Or, do we have to submit my even the hard deadlines? I can continue if we  
 do not have to submit even by the hard deadline.
 
 I am the type of person, I have to understand what I am doing, but just  
 memorizing and then performing.
 
 Thanks,
 
 Dr. Brenda Nelson-Porter
   [[alternative HTML version deleted]]
 

--
David Winsemius, MD
Alameda, CA, USA

__
R-help@r-project.org mailing list
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] a merge() problem

2012-10-07 Thread Peter Ehlers

On 2012-10-07 08:34, Sam Steingold wrote:

I know it does not look very good - using the same column names to mean
different things in different data frames, but here you go:
--8---cut here---start-8---

x - data.frame(a=c(1,2,3),b=c(4,5,6))
y - data.frame(b=c(1,2),a=c(a,b))
merge(x,y,by.x=a,by.y=b,all.x=TRUE,suffixes=c(,y))

   a ba
1 1 4a
2 2 5b
3 3 6 NA
Warning message:
In merge.data.frame(x, y, by.x = a, by.y = b, all.x = TRUE) :
   column name 'a' is duplicated in the result
--8---cut here---end---8---
why is the suffixes argument ignored?
I mean, I expected that the second a to be a.y.


The 'suffixes' argument refers to _non-by_ names only (as per ?merge).

Peter Ehlers


(when I omit suffixes, the result is the same).
Thanks.



__
R-help@r-project.org mailing list
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] Problem with national characters in main, xlab, ylab with pdf{grDevices} / postscript {grDevices}

2012-10-07 Thread Prof Brian Ripley
'National': not my nation, and none is stated.  Somewhere in Eastern 
Europe ... Poland?


Short answer: you need to use a family which contains those glyphs 
(try family='NimbusSan': the default 'Helvetica' does not) *and* a 
viewer that uses fonts that do.


Longer answer: read ?pdf and ?postscript carefully, as they told you 
this and more.


Your example works correctly with that family for me on Linux, 
but not with OS X viewers.  It does not with the default family.


For people on Unix I would suggest the cairo_pdf() device as a 
possibly easier alternative since it usually embeds fonts.  On 
Windows and OS X you are at the mercy of what fonts cairo has access 
to.  That's all in the help, too.


On Sun, 7 Oct 2012, Magdalena A. Tkacz wrote:


Hello.

I'm trying to make some graphics with nationalized labels (pdf for use
in LaTeX document).


On console (displayed on screen) using  all looks ok:
\/
data-rnorm(100)
hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
ylab='Częstość występowania')
---/\

But using:
---\/
data-rnorm(100)

pdf('plik.pdf',encoding=CP1250.enc)
hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
ylab='Częstość występowania')
dev.off()
/\

It does not look fine ...


Actually it is just a binary file, and no viewer has been mentioned.



Without specifying encoding:
---\/
pdf('plik-wo-enc.pdf')
hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
ylab='Częstość występowania')
dev.off()
-/\
Almost does not have national characters. (Almost, because ó letter appears)

Exemplary pdf file are here:
https://www.drivehq.com/file/df.aspx/shareID10318887/fileID1167942261/plik.pdf
https://www.drivehq.com/file/df.aspx/shareID10318887/fileID1167945977/plik-wo-enc.pdf


I have read Non-Standard Fonts in PostScript and PDF Graphics by
Paul Murrell and Brian Ripley in Rnews.

I have also tried option with
---\/
Sys.setlocale(category=LC_CTYPE, locale=pl_PL.utf8)
---/\
but even in admin (run R as admin) in Win7 I received warning:
---\/
In Sys.setlocale(category = LC_CTYPE, locale = pl_PL.utf8) :
Żądania raportów OS aby ustawić lokalizację na pl_PL.utf8 nie mogą
zostać wykonane
---/\
(translated in short : OS report request to set locale to pl_PL.utf8
can not be done)


Does anyone knows how to obtain pdf documents with acceptable quality?



Thanks in advance,

Regards

--
/|/| _ _ _/_ /_   _  /  / _ __
/   |(/(/(/(/((-/)(/ (  /((/( /_
_/
Magdalena Tkacz

__
R-help@r-project.org mailing list
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.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@r-project.org mailing list
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] Testing volatility cluster (heteroscedasticity) in stock return?

2012-10-07 Thread Eko andryanto Prakasa
Dear All,
i want to use garch model in return of stock. and the data should presence 
volatility cluster (Heteroscedasticity).
Do you know how to test volatility cluster (the presence of heteroscedasticity) 
in series data of stock return in R?
Is it using Langrange Multiplier (LM)  ARCH test? what package i should use?
I really need the help. Thanks for the attention.
Eko A P

__
R-help@r-project.org mailing list
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] a merge() problem

2012-10-07 Thread arun
Hi,

Though, this does give the result you wanted when the column names are the same.
 y1-y
 colnames(y1)-c(a,b)
merge(x,y1,by=a,all=TRUE,suffixes=c(,.y))
#  a b  b.y
#1 1 4    a
#2 2 5    b
#3 3 6 NA
A.K.




- Original Message -
From: Sam Steingold s...@gnu.org
To: r-help@r-project.org
Cc: 
Sent: Sunday, October 7, 2012 11:34 AM
Subject: [R] a merge() problem

I know it does not look very good - using the same column names to mean
different things in different data frames, but here you go:
--8---cut here---start-8---
 x - data.frame(a=c(1,2,3),b=c(4,5,6))
 y - data.frame(b=c(1,2),a=c(a,b))
 merge(x,y,by.x=a,by.y=b,all.x=TRUE,suffixes=c(,y))
  a b    a
1 1 4    a
2 2 5    b
3 3 6 NA
Warning message:
In merge.data.frame(x, y, by.x = a, by.y = b, all.x = TRUE) :
  column name 'a' is duplicated in the result
--8---cut here---end---8---
why is the suffixes argument ignored?
I mean, I expected that the second a to be a.y.
(when I omit suffixes, the result is the same).
Thanks.
-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://palestinefacts.org http://honestreporting.com
http://truepeace.org http://openvotingconsortium.org
My name is Deja Vu. Have we met before?

__
R-help@r-project.org mailing list
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
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] Testing volatility cluster (heteroscedasticity) in stock return?

2012-10-07 Thread R. Michael Weylandt
Hi Eko,

Please don't cross-post to both R-Help and R-SIG-Finance.

Michael

On Sun, Oct 7, 2012 at 6:49 PM, Eko andryanto Prakasa
eko.prak...@yahoo.com wrote:
 Dear All,
 i want to use garch model in return of stock. and the data should presence 
 volatility cluster (Heteroscedasticity).
 Do you know how to test volatility cluster (the presence of 
 heteroscedasticity) in series data of stock return in R?
 Is it using Langrange Multiplier (LM)  ARCH test? what package i should use?
 I really need the help. Thanks for the attention.
 Eko A P

 __
 R-help@r-project.org mailing list
 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
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] a merge() problem

2012-10-07 Thread Peter Ehlers

On 2012-10-07 10:50, arun wrote:

Hi,

Though, this does give the result you wanted when the column names are the same.
  y1-y
  colnames(y1)-c(a,b)
merge(x,y1,by=a,all=TRUE,suffixes=c(,.y))
#  a b  b.y
#1 1 4a
#2 2 5b
#3 3 6 NA
A.K.


Yes, because 'b' is _not_ a 'by'-name.

Peter Ehlers






- Original Message -
From: Sam Steingold s...@gnu.org
To: r-help@r-project.org
Cc:
Sent: Sunday, October 7, 2012 11:34 AM
Subject: [R] a merge() problem

I know it does not look very good - using the same column names to mean
different things in different data frames, but here you go:
--8---cut here---start-8---

x - data.frame(a=c(1,2,3),b=c(4,5,6))
y - data.frame(b=c(1,2),a=c(a,b))
merge(x,y,by.x=a,by.y=b,all.x=TRUE,suffixes=c(,y))

   a ba
1 1 4a
2 2 5b
3 3 6 NA
Warning message:
In merge.data.frame(x, y, by.x = a, by.y = b, all.x = TRUE) :
   column name 'a' is duplicated in the result
--8---cut here---end---8---
why is the suffixes argument ignored?
I mean, I expected that the second a to be a.y.
(when I omit suffixes, the result is the same).
Thanks.



__
R-help@r-project.org mailing list
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] Presence/ absence data from matrix to single column

2012-10-07 Thread Rui Barradas

Hello,

I haven't been following this thread but apparently the answer to your 
worries is no.
You can use a combination of names() and grep() to sort it out. 
something like


#nms - names(adat)
nms - c(Year, Route, Point, paste0(Sp, 1:250))

pattern - ^Sp[[:digit:]]+$
whichCols - grep(pattern, nms)
whichNames - nms[whichCols]

reshape(..., varying = whichCols, times = whichNames, ...)


Hope this helps,

Rui Barradas
Em 07-10-2012 15:35, agoijman escreveu:

The problem with that, is that I just wrote an example of my database, but I
have around 250 species and more than 500 sites. In the approach you show
me, it looks like I have to enter every species name and sites individually,
right?



--
View this message in context: 
http://r.789695.n4.nabble.com/Presence-absence-data-from-matrix-to-single-column-tp4645271p4645331.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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
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] Testing volatility cluster (heteroscedasticity) in stock return?

2012-10-07 Thread Eko andryanto Prakasa
Hi Michael,

I'm sorry for the mistake..
i don't know if it's not permitted to sent the same message to both (r-help and 
r-sig)
Thank's a lot for the information...

Eko



 
- Original Message -
From: R. Michael Weylandt michael.weyla...@gmail.com
To: Eko andryanto Prakasa eko.prak...@yahoo.com
Cc: r-help@R-project.org r-help@r-project.org
Sent: Monday, October 8, 2012 12:56 AM
Subject: Re: [R] Testing volatility cluster (heteroscedasticity) in stock 
return?

Hi Eko,

Please don't cross-post to both R-Help and R-SIG-Finance.

Michael

On Sun, Oct 7, 2012 at 6:49 PM, Eko andryanto Prakasa
eko.prak...@yahoo.com wrote:
 Dear All,
 i want to use garch model in return of stock. and the data should presence 
 volatility cluster (Heteroscedasticity).
 Do you know how to test volatility cluster (the presence of 
 heteroscedasticity) in series data of stock return in R?
 Is it using Langrange Multiplier (LM)  ARCH test? what package i should use?
 I really need the help. Thanks for the attention.
 Eko A P

 __
 R-help@r-project.org mailing list
 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
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] Presence/ absence data from matrix to single column

2012-10-07 Thread arun
Hi,
I guess you are not talking about the melt() method.
dat1-read.table(text=
Year    Route    Point    Sp1    Sp2    Sp3
2004    123    123-1    0    1    0
2004    123    123-2    0    1    1
2004    123    123-10    1    1    0
,header=TRUE,sep=,stringsAsFactors=FALSE)


#If all the Sp columns are located next to another as shown in your example 
dataset, then you can also try this:
name1-unlist(strsplit(paste(colnames(dat1)[4:6],collapse= ), ))
reshape(dat1,varying=4:6,v.name=Sp-value,times=name1,timevar=Sp-name,idvar=c(Year,Route,Point),direction=long)

A.K.






- Original Message -
From: Rui Barradas ruipbarra...@sapo.pt
To: agoijman agoij...@cnia.inta.gov.ar
Cc: r-help@r-project.org
Sent: Sunday, October 7, 2012 2:32 PM
Subject: Re: [R] Presence/ absence data from matrix to single column

Hello,

I haven't been following this thread but apparently the answer to your 
worries is no.
You can use a combination of names() and grep() to sort it out. 
something like

#nms - names(adat)
nms - c(Year, Route, Point, paste0(Sp, 1:250))

pattern - ^Sp[[:digit:]]+$
whichCols - grep(pattern, nms)
whichNames - nms[whichCols]

reshape(..., varying = whichCols, times = whichNames, ...)


Hope this helps,

Rui Barradas
Em 07-10-2012 15:35, agoijman escreveu:
 The problem with that, is that I just wrote an example of my database, but I
 have around 250 species and more than 500 sites. In the approach you show
 me, it looks like I have to enter every species name and sites individually,
 right?



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Presence-absence-data-from-matrix-to-single-column-tp4645271p4645331.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 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
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
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] Problem with national characters in main, xlab, ylab with pdf{grDevices} / postscript {grDevices}

2012-10-07 Thread Magdalena A. Tkacz
Hello.

Yes, you're right -Poland, Central/Eastern Europe.
My apologies - my fault  - not to state it directly in post.

Than you for your advice, especially concerning viewer (when OS is Win).

Under Windows (checked both on english and polish version of OS) works
fine with font family you proposed, previewed with Sumatra PDF or
TeXworks internal viewer (Adobe Reader does NOT display generated pdf
correctly ).

On my Linux workstation, cairo_pdf(fileName.pdf) works OK without any
additional parameters, both Okular and Document Viewer also works fine
as a viewers.

Thank You very much.
Problem solved.

Regards

Magdalena Tkacz


2012/10/7 Prof Brian Ripley rip...@stats.ox.ac.uk:
 'National': not my nation, and none is stated.  Somewhere in Eastern Europe
 ... Poland?

 Short answer: you need to use a family which contains those glyphs (try
 family='NimbusSan': the default 'Helvetica' does not) *and* a viewer that
 uses fonts that do.

 Longer answer: read ?pdf and ?postscript carefully, as they told you this
 and more.

 Your example works correctly with that family for me on Linux, but not with
 OS X viewers.  It does not with the default family.

 For people on Unix I would suggest the cairo_pdf() device as a possibly
 easier alternative since it usually embeds fonts.  On Windows and OS X you
 are at the mercy of what fonts cairo has access to.  That's all in the help,
 too.


 On Sun, 7 Oct 2012, Magdalena A. Tkacz wrote:

 Hello.

 I'm trying to make some graphics with nationalized labels (pdf for use
 in LaTeX document).


 On console (displayed on screen) using  all looks ok:
 \/
 data-rnorm(100)
 hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
 ylab='Częstość występowania')
 ---/\

 But using:
 ---\/
 data-rnorm(100)

 pdf('plik.pdf',encoding=CP1250.enc)
 hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
 ylab='Częstość występowania')
 dev.off()
 /\

 It does not look fine ...


 Actually it is just a binary file, and no viewer has been mentioned.


 Without specifying encoding:
 ---\/
 pdf('plik-wo-enc.pdf')
 hist(data,main='Rozkład gęstości punktów', xlab='Wartość na osi y',
 ylab='Częstość występowania')
 dev.off()
 -/\
 Almost does not have national characters. (Almost, because ó letter
 appears)

 Exemplary pdf file are here:

 https://www.drivehq.com/file/df.aspx/shareID10318887/fileID1167942261/plik.pdf

 https://www.drivehq.com/file/df.aspx/shareID10318887/fileID1167945977/plik-wo-enc.pdf


 I have read Non-Standard Fonts in PostScript and PDF Graphics by
 Paul Murrell and Brian Ripley in Rnews.

 I have also tried option with
 ---\/
 Sys.setlocale(category=LC_CTYPE, locale=pl_PL.utf8)
 ---/\
 but even in admin (run R as admin) in Win7 I received warning:
 ---\/
 In Sys.setlocale(category = LC_CTYPE, locale = pl_PL.utf8) :
 Żądania raportów OS aby ustawić lokalizację na pl_PL.utf8 nie mogą
 zostać wykonane
 ---/\
 (translated in short : OS report request to set locale to pl_PL.utf8
 can not be done)


 Does anyone knows how to obtain pdf documents with acceptable quality?



 Thanks in advance,

 Regards

 --
 /|/| _ _ _/_ /_   _  /  / _ __
 /   |(/(/(/(/((-/)(/ (  /((/( /_
 _/
 Magdalena Tkacz

 __
 R-help@r-project.org mailing list
 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.


 --
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595



-- 
/|/| _ _ _/_ /_   _  /  / _ __
/   |(/(/(/(/((-/)(/ (  /((/( /_
 _/
Magdalena Tkacz

__
R-help@r-project.org mailing list
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] gam error message: matrix not +ve definite

2012-10-07 Thread garth
Hello, 

I'm running a multimodel analysis which involves fitting several GAM models
as implemented in package mgcv.  The issue I'm having is that when I try to
fit my model, gam gives me the following error message: 'Error in
initial.sp(w * X, S, off) : S[[2]] matrix is not +ve definite.' The strange
part of this is that the error message stops my model fitting function when
run on a linux platform, but not on my local windows machine. Ordinarily I
would just run the analysis on my local machine, but I need to run this from
the linux machine to take advantage of the much larger computing capacity.
The version of mgcv(1.7-21) and R (2.15.1) is the same on both machines. 

The data set to which the model if fitted is too large to post here but it
contains 2209 observations, and the model is of the form: gam(Response~Year
+ s(Dayofyear,k=5,bs='cc') + s(Longitude,Latitude,k=4) +
s(Coast_distance,k=4), family=Gamma('log'), data=dat, gamma=1.4)

I realize this is a very particular question, but any help would be really
appreciated.
Thanks,
Dan.



--
View this message in context: 
http://r.789695.n4.nabble.com/gam-error-message-matrix-not-ve-definite-tp4645329.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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] BioConductor package: 'oligo'

2012-10-07 Thread Johnson, Franklin Theodore
Dear Help,



After loading the pd.Citrus library and checking the DataFrame, I ran
 the R code for:

 1) 'oligo'



 { library(pd.citrus)
 Loading required package: RSQLite
 Loading required package: DBI
  data(pmSequence)

  show(pmSequence)
 DataFrame with 341730 rows and 2 columns
 fid sequence
 integer DNAStringSet
 1 990 GCGGAACGATGGCGATGGCTA
 2 991 CGACGGGTTGCCTTCGGAGCTAAAT
 3 992 TACTGCAGAAGACCATTACCCTACA
 4 993 TCACATAGCTGTGCAAGGACCGTAT
 5 994 TCGCCTAGCAAAGCTGCCAGCATGT
 6 995 TTACGTCTACGTGGTGGTGCTAAGA
 7 996 CCGAACGACCTGTTGGACCAAAGCA
 8 999 AAGCTAGTCTAGCTCCACCGACGGC
 9 1000 CACCGGTGACGTGCCGGTCGC
 ... ... ...
 341722 963599 AAATTCGACACTTTACTGAGA
 341723 963790 GGATGCCCTCCGGTAATTGAATCAT
 341724 963802 GTTCAGCTCAAACCCTACATAGAGA
 341725 963818 GGATGTCTCAACCAGCTGGTT
 341726 963841 GAGAAGATGTTCAGAGGGCCCTACA
 341727 963859 GGTGCAGTTCGACTCTAAGTTTGCT
 341728 963863 AAACACGGTTATTCATCTGCGAAAC
 341729 963874 GATGCTCTTCATTGGGAGGCAGCGA
 341730 963889 ATTGATACAGCCTTCTCTGCAGTAA
  getwd()
 [1] C:/Users/franklin.johnson.PW50-WEN/Desktop/GSE33964_citrus epi
 cells/exData}

 {library(oligo)
  celFiles-list.celfiles(exData, full.names=TRUE)
  affyCit-read.celfiles(GSM839728_GF_28mm_EC-1.CEL,
 GSM839729_GF_28mm_EC-2.CEL, GSM839730_GF_28mm_EC-3.CEL,
 GSM839731_GF_28mm_PC-1.CEL, GSM839732_GF_28mm_PC-2.CEL,
 GSM839733_GF_28mm_PC-3.CEL, GSM839734_GF_41mm_EC-1.CEL,
 GSM839735_GF_41mm_EC-2.CEL, GSM839736_GF_41mm_EC-3.CEL,
 GSM839737_GF_41mm_PC-1.CEL, GSM839738_GF_41mm_PC-2.CEL,
 GSM839739_GF_41mm_PC-3.CEL, pkgname=pd.citrus)
 Platform design info loaded.
 Reading in : GSM839728_GF_28mm_EC-1.CEL
 Reading in : GSM839729_GF_28mm_EC-2.CEL
 Reading in : GSM839730_GF_28mm_EC-3.CEL
 Reading in : GSM839731_GF_28mm_PC-1.CEL
 Reading in : GSM839732_GF_28mm_PC-2.CEL
 Reading in : GSM839733_GF_28mm_PC-3.CEL
 Reading in : GSM839734_GF_41mm_EC-1.CEL
 Reading in : GSM839735_GF_41mm_EC-2.CEL
 Reading in : GSM839736_GF_41mm_EC-3.CEL
 Reading in : GSM839737_GF_41mm_PC-1.CEL
 Reading in : GSM839738_GF_41mm_PC-2.CEL
 Reading in : GSM839739_GF_41mm_PC-3.CEL
  pmSeq-pmSequence(affyCit)
  pmSeq[1:10]
 A DNAStringSet instance of length 10
 width seq
 [1] 25 GCGGAACGATGGCGATGGCTA
 [2] 25 CGACGGGTTGCCTTCGGAGCTAAAT
 [3] 25 TACTGCAGAAGACCATTACCCTACA
 [4] 25 TCACATAGCTGTGCAAGGACCGTAT
 [5] 25 TCGCCTAGCAAAGCTGCCAGCATGT
 [6] 25 TTACGTCTACGTGGTGGTGCTAAGA
 [7] 25 CCGAACGACCTGTTGGACCAAAGCA
 [8] 25 AAGCTAGTCTAGCTCCACCGACGGC
 [9] 25 CACCGGTGACGTGCCGGTCGC
 [10] 25 GGTTAAGCCCGGCACTATCCGGGCA
  pmsLog2-log2(pm(affyCit))
  plot(pmsLog2) #the plots looks good across arrays (object=affyCit)

 However, still get:
  coefs-getAffinitySplineCoefficients(pmsLog2, pmSeq)
 Error in model.frame.default(formula = intensities ~ design,
 drop.unused.levels = TRUE) :
 variable lengths differ (found for 'design')



 sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

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

other attached packages:
[1] oligo_1.22.0Biobase_2.18.0  oligoClasses_1.20.0
[4] BiocInstaller_1.8.1 BiocGenerics_0.4.0

loaded via a namespace (and not attached):
 [1] affxparser_1.30.0 affyio_1.26.0 Biostrings_2.26.1
 [4] bit_1.1-8 codetools_0.2-8   DBI_0.2-5
 [7] ff_2.2-7  foreach_1.4.0 GenomicRanges_1.10.1
[10] IRanges_1.16.2iterators_1.0.6   parallel_2.15.1
[13] preprocessCore_1.20.0 splines_2.15.1stats4_2.15.1
[16] tools_2.15.1  zlibbioc_1.4.0

I have been working on the issue for two weeks already.

For example, above I loaded the Citrus.pd, additionally, I tried working with 
library(citruscdf), although this did not work either?

Moreover, I used R 2.6 with the devel 'affyio' package version 1.27.1, but 
cannot run 'oligo' with R 2.6 for some reason (i.e. error in list.celFiles and 
read.celfiles commands), although R version for 'oligo' is 2.15 or greater, so 
cannot use the list matrix generated in 'affyio' version 1.27 on R 2.6 cause is 
does not seem compatible with 'oligo' version 1.22 on R 2.6. I am also using 
the recently updated BioC version 2.11.

In oligo using R v. 2.15, I am able to view the .CEL images, make boxplots, 
MAplots of the data, but cannot proceed beyond this point (as indicated above).



In summary, is this a bug in the 'oligo' package??



Any assistance is greatly appreciated.

If you have questions or need additional information, please feel free to 
contact me.



Best Regards,



Franklin



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide 

Re: [R] Format of numbers in plotmath expressions.

2012-10-07 Thread William Dunlap
In-line comments below.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com


 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On 
 Behalf
 Of Rolf Turner
 Sent: Friday, October 05, 2012 5:02 PM
 To: Uwe Ligges
 Cc: r-help@r-project.org
 Subject: Re: [R] Format of numbers in plotmath expressions.
 
 
 
 Thanks Uwe.  I think your recipe is substantially sexier than mine.
 
 However I will, I believe, ***NEVER*** understand how to put together
 plotmath constructs.  They seem to require some subset of:
 
  * expression()
  * bquote()
  * substitute()
  * parse()

Note that using parse was one source of your original problem.  You did
the equivalent of
   parse(text=paste(theta, 1., sep===))
which gives the same result as
   parse(text=paste(theta, 1, sep===))
because x==1. and x==1 should be parsed to be the same expression.

If you wanted the string 1. to come out of parse then you would have
to quote it, as in
  legend(topleft,pch=1:5,legend=parse(text=paste0(theta == \,TH,\)))
instead of your original
  legend(topleft,pch=1:5,legend=parse(text=paste0(theta == , TH)))
This works because plotmath does not render the quotes in strings.

I would recommend taking parse(), paste(), substitute(), and even expression() 
off 
your list of things to try when using plotmath.  For single chunks of plotmath 
text,
isn't bquote() sufficient?  For multiple chunks (e.g., the strings given to 
legend or axis)
I think you can restrict  yourself to the idiom
as.expression(lapply(data, function(d)bquote(...))) 

mapply would be fine here also, but I would avoid sapply, as its simplification 
algorithm
can surprise you.  expression() is good when you have a fixed (parameterless)
expression you want to display, but bquote is just as good, so don't bother 
thinking
about using expression() in plotmath.

Here is an example of mapply used to make axis tick labels of the form
num * pi / den, leaving out unneeded 1's, and related legend labels:

curve(sin, from=0, to=6.5, axes=FALSE)
num  - 0:8 ; den - 4 # want labels num * pi / den, simplified when possible
labs - as.expression(mapply(num, den, SIMPLIFY=FALSE, FUN=function(n, d)
{
gcd - function(a,b) ifelse (b==0, a, gcd(b, a %% b))
div - gcd(n, d)
if (div  1) {
n - n / div ; d - d / div
}
if (n==0) {
bquote(0)
} else if (d==1) {
if (n==1) {
bquote(pi)
} else {
bquote(.(n)*pi)
}
} else {
if (n==1) {
bquote(pi/.(d))
} else {
bquote(.(n)*pi/.(d))
}
}
}
))
axis(side=1, at=num*pi/den, lab=labs)
# Now put theta= on the front of each label for the legend
legend(bottomleft, as.expression(lapply(labs, 
function(lab)bquote(theta==.(lab)

I am not an expert on plotmath, but my feeling from watching people use
it is that they tend to lose track of the boundary between standard R functions
and the functions by the same name used by plotmath for different purposes
By sticking to using bquote() for creating single plotmath exressions and
as.expression(lapply(..., function(x)bquote(.(x for collections of plotmath
expressions, you can concentrate on the learning the plotmath language itself.

Are there plotmath expressions that cannot be made with bquote instead of
parse(text=paste(...))?  Perhaps not, but some with a variable number of
components may be more easily done with parse.

  * paste()
  * as.expression()
  * .(...)
 
 (and quite possibly other things that I have forgotten) in a bewildering
 variety of combinations with no perceptible rationale as what combination
 is required in what circumstances.
 
 It makes quantum mechanics look simple by comparison.
 
  cheers,
 
  Rolf
 
 On 06/10/12 06:58, Uwe Ligges wrote:
 
 
  On 05.10.2012 09:30, Rolf Turner wrote:
 
  I want to do something like:
 
  TH - sprintf(%1.1f,c(0.3,0.5,0.7,0.9,1))
  plot(1:10)
  legend(bottomright,pch=1:5,legend=parse(text=paste(theta ==,TH)))
 
  Notice that the final 1 comes out in the legend as just plain 1
  and NOT
  as 1.0 although TH is
 
  [1] 0.3 0.5 0.7 0.9 1.0
 
  I can get plotmath to preserve 1.0 as 1.0 and NOT convert it to 1
  if I use substitute, as in
 
  text(2,5,labels=substitute(list(theta == a),list(a=TH[5])))
 
  but substitute doesn't work appropriately with vectors.
 
  Can anyone tell me how to get a 1.0 rather than 1 in the legend?
 
  Ta.
 
   cheers,
 
   Rolf Turner
 
  P.S. Just figured out a way using sapply():
 
  leg - sapply(TH,function(x){substitute(list(theta == a),list(a=x))})
  plot(1:10)
  legend(bottomright,pch=1:5,legend=parse(text=leg))
 
  Note that the use of parse (pace Thomas Lumley! :-) ) is required ---
  legend=leg does NOT work.
 
  Getting here required an enormous amount of trial and error. And it
  

Re: [R] BioConductor package: 'oligo'

2012-10-07 Thread R. Michael Weylandt
Hi Franklin,

As you note, this is a bioconductor package, and they have a separate
mailing list for support (fully of terribly knowledgeable and
responsive folks) I know it's somewhat unpleasant to be told to look
elsewhere after you've spent a good amount of time on it already, but
I think it's worth your time to repost to that list:
http://www.bioconductor.org/help/mailing-list/mailform/

Cheers,
Michael

On Sun, Oct 7, 2012 at 5:22 PM, Johnson, Franklin Theodore
franklin.john...@email.wsu.edu wrote:
 Dear Help,



 After loading the pd.Citrus library and checking the DataFrame, I ran
 the R code for:

 1) 'oligo'



 { library(pd.citrus)
 Loading required package: RSQLite
 Loading required package: DBI
  data(pmSequence)

  show(pmSequence)
 DataFrame with 341730 rows and 2 columns
 fid sequence
 integer DNAStringSet
 1 990 GCGGAACGATGGCGATGGCTA
 2 991 CGACGGGTTGCCTTCGGAGCTAAAT
 3 992 TACTGCAGAAGACCATTACCCTACA
 4 993 TCACATAGCTGTGCAAGGACCGTAT
 5 994 TCGCCTAGCAAAGCTGCCAGCATGT
 6 995 TTACGTCTACGTGGTGGTGCTAAGA
 7 996 CCGAACGACCTGTTGGACCAAAGCA
 8 999 AAGCTAGTCTAGCTCCACCGACGGC
 9 1000 CACCGGTGACGTGCCGGTCGC
 ... ... ...
 341722 963599 AAATTCGACACTTTACTGAGA
 341723 963790 GGATGCCCTCCGGTAATTGAATCAT
 341724 963802 GTTCAGCTCAAACCCTACATAGAGA
 341725 963818 GGATGTCTCAACCAGCTGGTT
 341726 963841 GAGAAGATGTTCAGAGGGCCCTACA
 341727 963859 GGTGCAGTTCGACTCTAAGTTTGCT
 341728 963863 AAACACGGTTATTCATCTGCGAAAC
 341729 963874 GATGCTCTTCATTGGGAGGCAGCGA
 341730 963889 ATTGATACAGCCTTCTCTGCAGTAA
  getwd()
 [1] C:/Users/franklin.johnson.PW50-WEN/Desktop/GSE33964_citrus epi
 cells/exData}

 {library(oligo)
  celFiles-list.celfiles(exData, full.names=TRUE)
  affyCit-read.celfiles(GSM839728_GF_28mm_EC-1.CEL,
 GSM839729_GF_28mm_EC-2.CEL, GSM839730_GF_28mm_EC-3.CEL,
 GSM839731_GF_28mm_PC-1.CEL, GSM839732_GF_28mm_PC-2.CEL,
 GSM839733_GF_28mm_PC-3.CEL, GSM839734_GF_41mm_EC-1.CEL,
 GSM839735_GF_41mm_EC-2.CEL, GSM839736_GF_41mm_EC-3.CEL,
 GSM839737_GF_41mm_PC-1.CEL, GSM839738_GF_41mm_PC-2.CEL,
 GSM839739_GF_41mm_PC-3.CEL, pkgname=pd.citrus)
 Platform design info loaded.
 Reading in : GSM839728_GF_28mm_EC-1.CEL
 Reading in : GSM839729_GF_28mm_EC-2.CEL
 Reading in : GSM839730_GF_28mm_EC-3.CEL
 Reading in : GSM839731_GF_28mm_PC-1.CEL
 Reading in : GSM839732_GF_28mm_PC-2.CEL
 Reading in : GSM839733_GF_28mm_PC-3.CEL
 Reading in : GSM839734_GF_41mm_EC-1.CEL
 Reading in : GSM839735_GF_41mm_EC-2.CEL
 Reading in : GSM839736_GF_41mm_EC-3.CEL
 Reading in : GSM839737_GF_41mm_PC-1.CEL
 Reading in : GSM839738_GF_41mm_PC-2.CEL
 Reading in : GSM839739_GF_41mm_PC-3.CEL
  pmSeq-pmSequence(affyCit)
  pmSeq[1:10]
 A DNAStringSet instance of length 10
 width seq
 [1] 25 GCGGAACGATGGCGATGGCTA
 [2] 25 CGACGGGTTGCCTTCGGAGCTAAAT
 [3] 25 TACTGCAGAAGACCATTACCCTACA
 [4] 25 TCACATAGCTGTGCAAGGACCGTAT
 [5] 25 TCGCCTAGCAAAGCTGCCAGCATGT
 [6] 25 TTACGTCTACGTGGTGGTGCTAAGA
 [7] 25 CCGAACGACCTGTTGGACCAAAGCA
 [8] 25 AAGCTAGTCTAGCTCCACCGACGGC
 [9] 25 CACCGGTGACGTGCCGGTCGC
 [10] 25 GGTTAAGCCCGGCACTATCCGGGCA
  pmsLog2-log2(pm(affyCit))
  plot(pmsLog2) #the plots looks good across arrays (object=affyCit)

 However, still get:
  coefs-getAffinitySplineCoefficients(pmsLog2, pmSeq)
 Error in model.frame.default(formula = intensities ~ design,
 drop.unused.levels = TRUE) :
 variable lengths differ (found for 'design')



 sessionInfo()
 R version 2.15.1 (2012-06-22)
 Platform: i386-pc-mingw32/i386 (32-bit)

 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

 other attached packages:
 [1] oligo_1.22.0Biobase_2.18.0  oligoClasses_1.20.0
 [4] BiocInstaller_1.8.1 BiocGenerics_0.4.0

 loaded via a namespace (and not attached):
  [1] affxparser_1.30.0 affyio_1.26.0 Biostrings_2.26.1
  [4] bit_1.1-8 codetools_0.2-8   DBI_0.2-5
  [7] ff_2.2-7  foreach_1.4.0 GenomicRanges_1.10.1
 [10] IRanges_1.16.2iterators_1.0.6   parallel_2.15.1
 [13] preprocessCore_1.20.0 splines_2.15.1stats4_2.15.1
 [16] tools_2.15.1  zlibbioc_1.4.0

 I have been working on the issue for two weeks already.

 For example, above I loaded the Citrus.pd, additionally, I tried working with 
 library(citruscdf), although this did not work either?

 Moreover, I used R 2.6 with the devel 'affyio' package version 1.27.1, but 
 cannot run 'oligo' with R 2.6 for some reason (i.e. error in list.celFiles 
 and read.celfiles commands), although R version for 'oligo' is 2.15 or 
 greater, so cannot use the list matrix generated in 'affyio' version 1.27 on 
 R 2.6 cause is does not seem compatible with 'oligo' version 1.22 on R 2.6. I 
 am also using the recently updated BioC version 2.11.

 In oligo using R v. 2.15, I am able to view the .CEL images, make boxplots, 
 MAplots of the data, 

Re: [R] gam error message: matrix not +ve definite

2012-10-07 Thread R. Michael Weylandt
On Sun, Oct 7, 2012 at 3:00 PM, garth dbo...@dal.ca wrote:
 Hello,

 I'm running a multimodel analysis which involves fitting several GAM models
 as implemented in package mgcv.  The issue I'm having is that when I try to
 fit my model, gam gives me the following error message: 'Error in
 initial.sp(w * X, S, off) : S[[2]] matrix is not +ve definite.' The strange
 part of this is that the error message stops my model fitting function when
 run on a linux platform, but not on my local windows machine. Ordinarily I
 would just run the analysis on my local machine, but I need to run this from
 the linux machine to take advantage of the much larger computing capacity.
 The version of mgcv(1.7-21) and R (2.15.1) is the same on both machines.

 The data set to which the model if fitted is too large to post here but it
 contains 2209 observations, and the model is of the form: gam(Response~Year
 + s(Dayofyear,k=5,bs='cc') + s(Longitude,Latitude,k=4) +
 s(Coast_distance,k=4), family=Gamma('log'), data=dat, gamma=1.4)

 I realize this is a very particular question, but any help would be really
 appreciated.
 Thanks,
 Dan.


It's a bit of a shot in the dark, but might it reflect data that is
close to not being non-positive-definite and differences in BLAS?

The only other think I'd try would be a

update.packages(checkBuilt = TRUE, ask = FALSE)

to just update every package you've got installed. It might not be
that the error is from mgcv proper, but rather a dependency thereof
which is in different versions between the machines.

Also, I note you're posting through Nabble. Nabble actually only
mirrors the R-Help mailing list, so we (the majority of respondents
who don't use Nabble) don't get a forum view, but rather only emails
of individual posts. The net result of this is that we don't see
context of your follow-up postings unless you specifically include it,
but it's much appreciated if you do. I believe there might also be a
button which does so automatically, but I'll leave finding that to
you.


Cheers,
Michael

__
R-help@r-project.org mailing list
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] Testing volatility cluster (heteroscedasticity) in stock return?

2012-10-07 Thread R. Michael Weylandt
On Sun, Oct 7, 2012 at 7:59 PM, Eko andryanto Prakasa
eko.prak...@yahoo.com wrote:
 Hi Michael,

 I'm sorry for the mistake..
 i don't know if it's not permitted to sent the same message to both (r-help 
 and r-sig)
 Thank's a lot for the information...

 Eko


No worries, it's a common enough first mistake. In the future, this
(and most of your previous postings) is definitely a
finance-specific question, so it should go there only.

Cheers,
Michael

__
R-help@r-project.org mailing list
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] Presence/ absence data from matrix to single column

2012-10-07 Thread David L Carlson
You should keep the context of your thread intact for those of us using
email instead of Nabble.

The locations were not listed individually anywhere in the reshape()
command. I listed Point as the id variable so reshape would use that to
create row names, but if you delete idvar=Point, reshape will give each
row a consecutive number followed by the species name or number.

I did list the species names individually in the times= argument to make
things a bit clearer since reshape() can be a confusing command at first.
But this would work as well:

reshape(adat, varying=4:6, v.name=Sp-value, 
  times=names(adat)[4:6], idvar=Point, 
  timevar=Sp-name, direction=long)

--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352

 Date: Sun, 7 Oct 2012 07:35:42 -0700 (PDT)
 From: agoijman agoij...@cnia.inta.gov.ar
 To: r-help@r-project.org
 Subject: Re: [R] Presence/ absence data from matrix to single column
 
 
 The problem with that, is that I just wrote an example of my database, but
I
 have around 250 species and more than 500 sites. In the approach you show
 me, it looks like I have to enter every species name and sites
individually,
 right?
 
 
 --
 View this message in context:
http://r.789695.n4.nabble.com/Presence-absence-data-from-matrix-to-single-co
lumn-tp4645271p4645331.html
 Sent from the R help mailing list archive at Nabble.com.
 
 _
 R-help@r-project.org mailing list
 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.
  -Original Message-
  From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
  project.org] On Behalf Of David L Carlson
  Sent: Saturday, October 06, 2012 10:25 PM
  To: 'Jim Lemon'; 'agoijman'
  Cc: r-help@r-project.org
  Subject: Re: [R] Presence/ absence data from matrix to single column
  
  Also reshape() will work:
  
  adat-data.frame(Year=rep(2004,3),Route=rep(123,3),
Point=c(123-1,123-2,123-10),Sp1=c(0,0,1),
Sp2=c(1,1,1),Sp3=c(0,1,0))
  reshape(adat, varying=4:6, v.name=Sp-value,
times=c(Sp1, Sp2, Sp3), idvar=Point,
timevar=Sp-name, direction=long)
  
  --
  David L Carlson
  Associate Professor of Anthropology
  Texas AM University
  College Station, TX 77843-4352
  
  
   -Original Message-
   From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
   project.org] On Behalf Of Jim Lemon
   Sent: Saturday, October 06, 2012 7:36 PM
   To: agoijman
   Cc: r-help@r-project.org
   Subject: Re: [R] Presence/ absence data from matrix to single column
  
   On 10/07/2012 01:03 AM, agoijman wrote:
I've been trying to reshape this database but haven't succeed at
  it.
   I tried
using loops but can't get it right. I just want to reshape my
   database from
this matrix, to the one below, with only one column of data.
   
YearRoute   Point   Sp1 Sp2 Sp3
2004123 123-1   0   1   0
2004123 123-2   0   1   1
2004123 123-10  1   1   0
   
What I want:
   
YearRoute   Point
2004123 123-1   Sp1 0
2004123 123-2   Sp1 0
2004123 123-10  Sp1 1
2004123 123-1   Sp2 1
2004123 123-2   Sp2 1
2004123 123-10  Sp2 1
2004123 123-1   Sp3 0
2004123 123-2   Sp3 1
2004123 123-10  Sp3 0
   
   
   Hi agoijman,
   You can do this using the rep_n_stack function.
  
   adat-data.frame(Year=rep(2004,3),Route=rep(123,3),
 Point=c(123-1,123-2,123-10),Sp1=c(0,0,1),
 Sp2=c(1,1,1),Sp3=c(0,1,0))
   library(prettyR)
   rep_n_stack(adat,c(Sp1,Sp2,Sp3),
 stack.names=c(Sp-names,Sp-values))
  
   Jim
  
   __
   R-help@r-project.org mailing list
   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
  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
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] Robust regression for ordered data

2012-10-07 Thread Eiko Fried
I have two regressions to perform - one with a metric DV (-3 to 3), the
other with an ordered DV (0,1,2,3).

Neither normal distribution not homoscedasticity is given. I have a two
questions:

(1) Some sources say robust regression take care of both lack of normal
distribution and heteroscedasticity, while others say only of normal
distribution. What is true?
(2) Are there ways of using robust regressions with ordered data, or is
that only possible for metric DVs?

Thanks
Torvon

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] a merge() problem

2012-10-07 Thread Sam Steingold
 * Peter Ehlers ruy...@hpnytnel.pn [2012-10-07 10:03:42 -0700]:

 On 2012-10-07 08:34, Sam Steingold wrote:
 I know it does not look very good - using the same column names to mean
 different things in different data frames, but here you go:
 --8---cut here---start-8---
 x - data.frame(a=c(1,2,3),b=c(4,5,6))
 y - data.frame(b=c(1,2),a=c(a,b))
 merge(x,y,by.x=a,by.y=b,all.x=TRUE,suffixes=c(,y))
a ba
 1 1 4a
 2 2 5b
 3 3 6 NA
 Warning message:
 In merge.data.frame(x, y, by.x = a, by.y = b, all.x = TRUE) :
column name 'a' is duplicated in the result
 --8---cut here---end---8---
 why is the suffixes argument ignored?
 I mean, I expected that the second a to be a.y.

 The 'suffixes' argument refers to _non-by_ names only (as per ?merge).

yes, but a in y is _not_ a by-name.

-- 
Sam Steingold (http://sds.podval.org/) on Ubuntu 12.04 (precise) X 11.0.11103000
http://www.childpsy.net/ http://americancensorship.org
http://think-israel.org http://www.memritv.org http://mideasttruth.com
Save time: send elected officials to jail directly, bypassing the office.

__
R-help@r-project.org mailing list
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] Robust regression for ordered data

2012-10-07 Thread Jeff Newmiller
This does not appear to be a question about R. You should post in a list or 
forum dedicated to discussing statistics theory, such as 
stats.stackoverflow.com.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

Eiko Fried tor...@gmail.com wrote:

I have two regressions to perform - one with a metric DV (-3 to 3), the
other with an ordered DV (0,1,2,3).

Neither normal distribution not homoscedasticity is given. I have a two
questions:

(1) Some sources say robust regression take care of both lack of normal
distribution and heteroscedasticity, while others say only of normal
distribution. What is true?
(2) Are there ways of using robust regressions with ordered data, or is
that only possible for metric DVs?

Thanks
Torvon

   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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
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] Robust regression for ordered data

2012-10-07 Thread Eiko Fried
Thank you Jeff! Please ignore the first of my two questions then, and
apologies for not making it clear that my second question was about R.

(2) Are there ways of using robust regressions with ordered data ... in
R?

Thank you


On 7 October 2012 18:26, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote:

 This does not appear to be a question about R. You should post in a list
 or forum dedicated to discussing statistics theory, such as
 stats.stackoverflow.com.
 ---
 Jeff NewmillerThe .   .  Go Live...
 DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

 Eiko Fried tor...@gmail.com wrote:

 I have two regressions to perform - one with a metric DV (-3 to 3), the
 other with an ordered DV (0,1,2,3).
 
 Neither normal distribution not homoscedasticity is given. I have a two
 questions:
 
 (1) Some sources say robust regression take care of both lack of normal
 distribution and heteroscedasticity, while others say only of normal
 distribution. What is true?
 (2) Are there ways of using robust regressions with ordered data, or is
 that only possible for metric DVs?
 
 Thanks
 Torvon
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 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.



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Presence/ absence data from matrix to single column

2012-10-07 Thread Andrea Goijman
Ill try this one as well.

And I guess the one below is not going  to work, because all my species
have different names.

Thanks!

#nms - names(adat)
nms - c(Year, Route, Point, paste0(Sp, 1:250))

pattern - ^Sp[[:digit:]]+$
whichCols - grep(pattern, nms)
whichNames - nms[whichCols]

reshape(..., varying = whichCols, times = whichNames, ...)
On Sun, Oct 7, 2012 at 3:02 PM, arun smartpink...@yahoo.com wrote:

 Hi,
 I guess you are not talking about the melt() method.
 dat1-read.table(text=
 YearRoutePointSp1Sp2Sp3
 2004123123-1010
 2004123123-2011
 2004123123-10110
 ,header=TRUE,sep=,stringsAsFactors=FALSE)


 #If all the Sp columns are located next to another as shown in your
 example dataset, then you can also try this:
 name1-unlist(strsplit(paste(colnames(dat1)[4:6],collapse= ), ))
 reshape(dat1,varying=4:6,v.name
 =Sp-value,times=name1,timevar=Sp-name,idvar=c(Year,Route,Point),direction=long)

 A.K.






 - Original Message -
 From: Rui Barradas ruipbarra...@sapo.pt
 To: agoijman agoij...@cnia.inta.gov.ar
 Cc: r-help@r-project.org
 Sent: Sunday, October 7, 2012 2:32 PM
 Subject: Re: [R] Presence/ absence data from matrix to single column

 Hello,

 I haven't been following this thread but apparently the answer to your
 worries is no.
 You can use a combination of names() and grep() to sort it out.
 something like

 #nms - names(adat)
 nms - c(Year, Route, Point, paste0(Sp, 1:250))

 pattern - ^Sp[[:digit:]]+$
 whichCols - grep(pattern, nms)
 whichNames - nms[whichCols]

 reshape(..., varying = whichCols, times = whichNames, ...)


 Hope this helps,

 Rui Barradas
 Em 07-10-2012 15:35, agoijman escreveu:
  The problem with that, is that I just wrote an example of my database,
 but I
  have around 250 species and more than 500 sites. In the approach you show
  me, it looks like I have to enter every species name and sites
 individually,
  right?
 
 
 
  --
  View this message in context:
 http://r.789695.n4.nabble.com/Presence-absence-data-from-matrix-to-single-column-tp4645271p4645331.html
  Sent from the R help mailing list archive at Nabble.com.
 
  __
  R-help@r-project.org mailing list
  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
 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.




-- 
---
Lic. Andrea Paula Goijman
Grupo Ecología y Gestión Ambiental de la Biodiversidad
IRB - INTA Castelar, Argentina
agoij...@cnia.inta.gov.ar
 http://inta.gob.ar/personas/goijman.andrea/
http://inta.gob.ar/personas/goijman.andrea/

PhD Candidate
Georgia Cooperative Fish and Wildlife Research Unit
D.B. Warnell School of Forestry and Natural Resources
University of Georgia
Athens, GA 30602 USA
Tel. +706.206.4805
andre...@uga.edu

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Robust regression for ordered data

2012-10-07 Thread Bert Gunter
Have you checked the Robust task view on CRAN?? Would seem that that
should have been the first place to look.

-- Bert

On Sun, Oct 7, 2012 at 3:30 PM, Eiko Fried tor...@gmail.com wrote:
 Thank you Jeff! Please ignore the first of my two questions then, and
 apologies for not making it clear that my second question was about R.

 (2) Are there ways of using robust regressions with ordered data ... in
 R?

 Thank you


 On 7 October 2012 18:26, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote:

 This does not appear to be a question about R. You should post in a list
 or forum dedicated to discussing statistics theory, such as
 stats.stackoverflow.com.
 ---
 Jeff NewmillerThe .   .  Go Live...
 DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

 Eiko Fried tor...@gmail.com wrote:

 I have two regressions to perform - one with a metric DV (-3 to 3), the
 other with an ordered DV (0,1,2,3).
 
 Neither normal distribution not homoscedasticity is given. I have a two
 questions:
 
 (1) Some sources say robust regression take care of both lack of normal
 distribution and heteroscedasticity, while others say only of normal
 distribution. What is true?
 (2) Are there ways of using robust regressions with ordered data, or is
 that only possible for metric DVs?
 
 Thanks
 Torvon
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 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.



 [[alternative HTML version deleted]]

 __
 R-help@r-project.org mailing list
 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@r-project.org mailing list
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] Robust regression for ordered data

2012-10-07 Thread Jeff Newmiller
I don't know about the topic of your question. Have you used the RSiteSearch 
function to research it yourself?
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

Eiko Fried tor...@gmail.com wrote:

Thank you Jeff! Please ignore the first of my two questions then, and
apologies for not making it clear that my second question was about R.

(2) Are there ways of using robust regressions with ordered data ...
in
R?

Thank you


On 7 October 2012 18:26, Jeff Newmiller jdnew...@dcn.davis.ca.us
wrote:

 This does not appear to be a question about R. You should post in a
list
 or forum dedicated to discussing statistics theory, such as
 stats.stackoverflow.com.

---
 Jeff NewmillerThe .   .  Go
Live...
 DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

 Eiko Fried tor...@gmail.com wrote:

 I have two regressions to perform - one with a metric DV (-3 to 3),
the
 other with an ordered DV (0,1,2,3).
 
 Neither normal distribution not homoscedasticity is given. I have a
two
 questions:
 
 (1) Some sources say robust regression take care of both lack of
normal
 distribution and heteroscedasticity, while others say only of normal
 distribution. What is true?
 (2) Are there ways of using robust regressions with ordered data, or
is
 that only possible for metric DVs?
 
 Thanks
 Torvon
 
[[alternative HTML version deleted]]
 
 __
 R-help@r-project.org mailing list
 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
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] dist based kmeans clustering

2012-10-07 Thread eliza botto

Dear useRs,

i have a matrix X and i generated a distance matrix of X, let us call it Y. I 
did hierarchical clustering of Y and got some results. I just wanted to know 
that can i use the same distance matrix Y in Kmeans clustering? If not, then 
how can i use my own distance matrix for kmeans clustering? 

thanks in advance..
eliza

  
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] Presence/ absence data from matrix to single column

2012-10-07 Thread Rui Barradas

Hello,

If all your species have different names, you can allways try one of
1. if the non-species follow a pattern, negate those columns and you'll 
have the species columns.

2. are the species the last columns? Use positional referencing.

Rui Barradas
Em 08-10-2012 00:16, Andrea Goijman escreveu:

Ill try this one as well.

And I guess the one below is not going  to work, because all my species
have different names.

Thanks!

#nms - names(adat)
nms - c(Year, Route, Point, paste0(Sp, 1:250))

pattern - ^Sp[[:digit:]]+$
whichCols - grep(pattern, nms)
whichNames - nms[whichCols]

reshape(..., varying = whichCols, times = whichNames, ...)
On Sun, Oct 7, 2012 at 3:02 PM, arun smartpink...@yahoo.com wrote:


Hi,
I guess you are not talking about the melt() method.
dat1-read.table(text=
YearRoutePointSp1Sp2Sp3
2004123123-1010
2004123123-2011
2004123123-10110
,header=TRUE,sep=,stringsAsFactors=FALSE)


#If all the Sp columns are located next to another as shown in your
example dataset, then you can also try this:
name1-unlist(strsplit(paste(colnames(dat1)[4:6],collapse= ), ))
reshape(dat1,varying=4:6,v.name
=Sp-value,times=name1,timevar=Sp-name,idvar=c(Year,Route,Point),direction=long)

A.K.






- Original Message -
From: Rui Barradas ruipbarra...@sapo.pt
To: agoijman agoij...@cnia.inta.gov.ar
Cc: r-help@r-project.org
Sent: Sunday, October 7, 2012 2:32 PM
Subject: Re: [R] Presence/ absence data from matrix to single column

Hello,

I haven't been following this thread but apparently the answer to your
worries is no.
You can use a combination of names() and grep() to sort it out.
something like

#nms - names(adat)
nms - c(Year, Route, Point, paste0(Sp, 1:250))

pattern - ^Sp[[:digit:]]+$
whichCols - grep(pattern, nms)
whichNames - nms[whichCols]

reshape(..., varying = whichCols, times = whichNames, ...)


Hope this helps,

Rui Barradas
Em 07-10-2012 15:35, agoijman escreveu:

The problem with that, is that I just wrote an example of my database,

but I

have around 250 species and more than 500 sites. In the approach you show
me, it looks like I have to enter every species name and sites

individually,

right?



--
View this message in context:

http://r.789695.n4.nabble.com/Presence-absence-data-from-matrix-to-single-column-tp4645271p4645331.html

Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
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
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
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] Presence/ absence data from matrix to single column

2012-10-07 Thread arun


HI,

Sorry, I complicated a code where it was not required at all.
Just using colnames(dat1)[4:6] or names(dat1)[4:6] should work if the species 
columns are adjacent to each other.


reshape(dat1,varying=4:6,v.name=Sp-value,times=colnames(dat1)[4:6],timevar=Sp-name,idvar=c(Year,Route,Point),direction=long)
#or
reshape(dat1,varying=4:6,v.name=Sp-value,times=names(dat1)[4:6],timevar=Sp-name,idvar=c(Year,Route,Point),direction=long)
A.K.


From: Andrea Goijman agoij...@cnia.inta.gov.ar
To: arun smartpink...@yahoo.com 
Cc: Rui Barradas ruipbarra...@sapo.pt; R help r-help@r-project.org 
Sent: Sunday, October 7, 2012 7:16 PM
Subject: Re: [R] Presence/ absence data from matrix to single column


Ill try this one as well.

And I guess the one below is not going  to work, because all my species have 
different names.

Thanks!

#nms - names(adat)
nms - c(Year, Route, Point, paste0(Sp, 1:250))

pattern - ^Sp[[:digit:]]+$
whichCols - grep(pattern, nms)
whichNames - nms[whichCols]

reshape(..., varying = whichCols, times = whichNames, ...)

On Sun, Oct 7, 2012 at 3:02 PM, arun smartpink...@yahoo.com wrote:

Hi,
I guess you are not talking about the melt() method.
dat1-read.table(text=

Year    Route    Point    Sp1    Sp2    Sp3
2004    123    123-1    0    1    0
2004    123    123-2    0    1    1
2004    123    123-10    1    1    0
,header=TRUE,sep=,stringsAsFactors=FALSE)


#If all the Sp columns are located next to another as shown in your example 
dataset, then you can also try this:
name1-unlist(strsplit(paste(colnames(dat1)[4:6],collapse= ), ))
reshape(dat1,varying=4:6,v.name=Sp-value,times=name1,timevar=Sp-name,idvar=c(Year,Route,Point),direction=long)


A.K.






- Original Message -

From: Rui Barradas ruipbarra...@sapo.pt
To: agoijman agoij...@cnia.inta.gov.ar
Cc: r-help@r-project.org
Sent: Sunday, October 7, 2012 2:32 PM
Subject: Re: [R] Presence/ absence data from matrix to single column

Hello,

I haven't been following this thread but apparently the answer to your
worries is no.
You can use a combination of names() and grep() to sort it out.
something like

#nms - names(adat)
nms - c(Year, Route, Point, paste0(Sp, 1:250))

pattern - ^Sp[[:digit:]]+$
whichCols - grep(pattern, nms)
whichNames - nms[whichCols]

reshape(..., varying = whichCols, times = whichNames, ...)


Hope this helps,

Rui Barradas
Em 07-10-2012 15:35, agoijman escreveu:
 The problem with that, is that I just wrote an example of my database, but I
 have around 250 species and more than 500 sites. In the approach you show
 me, it looks like I have to enter every species name and sites individually,
 right?



 --
 View this message in context: 
 http://r.789695.n4.nabble.com/Presence-absence-data-from-matrix-to-single-column-tp4645271p4645331.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list

 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

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.




-- 

---Lic. Andrea Paula Goijman
Grupo Ecología y Gestión Ambiental de la Biodiversidad
IRB - INTA Castelar, Argentina
agoij...@cnia.inta.gov.arhttp://inta.gob.ar/personas/goijman.andrea/


PhD Candidate
Georgia Cooperative Fish and Wildlife Research Unit

D.B. Warnell School of Forestry and Natural Resources
University of Georgia
Athens, GA 30602 USA
Tel. +706.206.4805
andre...@uga.edu

__
R-help@r-project.org mailing list
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] multinomial MCMCglmm

2012-10-07 Thread Ben Bolker
Vaniscotte vanamelie at gmail.com writes:

 
 Dear all,
 
 I would like to add mixed effects in a multinomial model and I am trying
 to use MCMCglmm for that.
  
 [snip]

  ill-conditioned G/R structure: use proper priors if you haven't or 
 rescale data if you have
 
 I guess that the problem comes from the nature of my observations which
 are frequencies instead of 0/1 per unit
 
 Does someone know if a multinomial model fitted with MCMCglmm can handle
 those frequencies table and how to specify the good G/R variance
 structures?
 

  (1) you should probably post this to r-sig-mixed-mod...@r-project.org
instead (and try to post only once ...)

  (2) multinomial models generally require *integer* responses (although
not necessarily 0/1); if you don't have a natural denominator, you may
have to think a bit harder about this (a Dirichlet distribution would be
the natural way to model frequencies that sum to 1)

  (3) have you read the course notes vignette that comes with MCMCglmm?

  Ben Bolker

__
R-help@r-project.org mailing list
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] a merge() problem

2012-10-07 Thread Peter Ehlers

On 2012-10-07 14:44, Sam Steingold wrote:

* Peter Ehlers ruy...@hpnytnel.pn [2012-10-07 10:03:42 -0700]:

On 2012-10-07 08:34, Sam Steingold wrote:

I know it does not look very good - using the same column names to mean
different things in different data frames, but here you go:
--8---cut here---start-8---

x - data.frame(a=c(1,2,3),b=c(4,5,6))
y - data.frame(b=c(1,2),a=c(a,b))
merge(x,y,by.x=a,by.y=b,all.x=TRUE,suffixes=c(,y))

a ba
1 1 4a
2 2 5b
3 3 6 NA
Warning message:
In merge.data.frame(x, y, by.x = a, by.y = b, all.x = TRUE) :
column name 'a' is duplicated in the result
--8---cut here---end---8---
why is the suffixes argument ignored?
I mean, I expected that the second a to be a.y.


The 'suffixes' argument refers to _non-by_ names only (as per ?merge).


yes, but a in y is _not_ a by-name.


Yes, it is.
The set of by-names is the union of names specified by by.x and by.y,
in your case: c(a, b).
I suppose that a case could be made that ?merge does not spell that
out sufficiently explicitly.

Peter Ehlers

__
R-help@r-project.org mailing list
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] Removing header from a matrix

2012-10-07 Thread Dereje Bacha
I have three column vectors (X1, X2, X3). 
    X1  X2  X3 
   20   25  40
   100 90  80
I want to put them as one matrix of dimention 2 by 3,  but remove 
headers(X1,X2,X3) from the matrix. I wrote
as follows

U-cbind (X1,X2,X3)

the headers are there. I need help please. Thanks
Dereje
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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 header from a matrix

2012-10-07 Thread Jeff Newmiller
You need to clarify what you have and what you want. Please use the dput() 
function to create a reproducible example that we can enter into R to make 
suggestions about. [1]

There are a couple of possible things that could be going on here, and what you 
have given so far is ambiguous.

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

Dereje Bacha d_ba...@yahoo.com wrote:

I have three column vectors (X1, X2, X3).�
��� X1� X2� X3 
�� 20�� 25� 40
�� 100 90� 80
I want to put them as one matrix of dimention 2 by 3, �but remove
headers(X1,X2,X3) from the matrix. I wrote
as follows

U-cbind (X1,X2,X3)

the headers are there. I need help please. Thanks
Dereje
   [[alternative HTML version deleted]]





__
R-help@r-project.org mailing list
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
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 header from a matrix

2012-10-07 Thread David L Carlson
These are just column names, but if you want to remove them, it is easy:

 X1 - c(20, 100)
 X2 - c(25, 90)
 X3 - c(40, 80)
 U - cbind(X1, X2, X3)
 U
  X1 X2 X3
[1,]  20 25 40
[2,] 100 90 80
 colnames(U) - NULL
 U
 [,1] [,2] [,3]
[1,]   20   25   40
[2,]  100   90   80


--
David L Carlson
Associate Professor of Anthropology
Texas AM University
College Station, TX 77843-4352

 -Original Message-
 From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
 project.org] On Behalf Of Dereje Bacha
 Sent: Sunday, October 07, 2012 10:13 PM
 To: r-help@r-project.org
 Subject: [R] Removing header from a matrix
 
 I have three column vectors (X1, X2, X3).
 X1  X2  X3
20   25  40
100 90  80
 I want to put them as one matrix of dimention 2 by 3,  but remove
 headers(X1,X2,X3) from the matrix. I wrote
 as follows
 
 U-cbind (X1,X2,X3)
 
 the headers are there. I need help please. Thanks
 Dereje
   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] nlminb problem, convergence error code = 1

2012-10-07 Thread zugi young
Hi, I was trying to do a multi-level modeling of the data using the nlme
package. I encounter the following message:

 addRandomSlopeRange- lme(FAN.range ~ CHN.range + Age + Block.T,
data=data.block, random = ~CHN.range|CHI, method = ML, na.action=na.omit)

Error in lme.formula(FAN.range ~ CHN.range + Age + Block.T, data =
data.block,  :
  nlminb problem, convergence error code = 1
  message = iteration limit reached without convergence (10)

I get this error message only when FAN.range or FAN.avg is used as the
dependent variable.

 head(data.block)
  Block.N Block.T  CHI Age  CHN.avg  FAN.avg  CHN.min  FAN.min   CHN.max
1   3AICF C003 765 8.676307 7.257332 7.619782 5.033533  9.428432
2  25AICF C003 765 8.227647 6.475297 4.853860 4.452857 10.430625
3  32AICF C003 765 8.381634 6.720497 6.700553 4.977628  9.049861
4  50AICF C003 765 8.113471 6.037453 6.294747 4.958514  9.593018
5  59AICF C003 765 8.301553 7.444806 7.587508 4.808462 10.975600
6  61AICF C003 765 7.895683 6.319403 4.455857 4.198858 11.331577
FAN.max CHN.rate FAN.rate   CHN.dur  FAN.dur CHN.range FAN.range
1  9.995912 2.09 2.394000 0.633 1.984000  1.808650  4.962380
2  8.296612 2.53 2.91 1.580 1.335000  5.576765  3.843754
3  9.275749 2.46 2.767500 0.820 1.862500  2.349308  4.298121
4  7.914313 2.604286 3.112500 1.053 1.206250  3.298271  2.955799
5 11.436886 2.26 2.73 1.330 2.20  3.388092  6.628425
6 10.865545 3.00 2.77 1.000 1.526667  6.875720  6.87

The following work fine:
addRandomSlopeAvg- lme(CHN.avg ~ FAN.avg + Age + Block.T, data=data.block,
random = ~FAN.avg|CHI, method = ML, na.action=na.omit)
addRandomSlopeRange- lme(CHN.range ~ FAN.range + Age + Block.T,
data=data.block, random = ~FAN.range|CHI, method = ML, na.action=na.omit)
addRandomSlopeMin- lme(FAN.min ~ CHN.min + Age + Block.T, data=data.block,
random = ~CHN.min|CHI, method = ML, na.action=na.omit)
addRandomSlopeMax- lme(FAN.max ~ CHN.max + Age + Block.T, data=data.block,
random = ~CHN.max|CHI, method = ML, na.action=na.omit)

It is really strange that the script runs fine for minimum and maximum
values but not for the average. Does anyone have an insight?

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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] a merge() problem

2012-10-07 Thread Prof Brian Ripley

On 08/10/2012 02:57, Peter Ehlers wrote:

On 2012-10-07 14:44, Sam Steingold wrote:

* Peter Ehlers ruy...@hpnytnel.pn [2012-10-07 10:03:42 -0700]:

On 2012-10-07 08:34, Sam Steingold wrote:

I know it does not look very good - using the same column names to mean
different things in different data frames, but here you go:
--8---cut here---start-8---

x - data.frame(a=c(1,2,3),b=c(4,5,6))
y - data.frame(b=c(1,2),a=c(a,b))
merge(x,y,by.x=a,by.y=b,all.x=TRUE,suffixes=c(,y))

a ba
1 1 4a
2 2 5b
3 3 6 NA
Warning message:
In merge.data.frame(x, y, by.x = a, by.y = b, all.x = TRUE) :
column name 'a' is duplicated in the result
--8---cut here---end---8---
why is the suffixes argument ignored?
I mean, I expected that the second a to be a.y.


The 'suffixes' argument refers to _non-by_ names only (as per ?merge).


yes, but a in y is _not_ a by-name.


Yes, it is.
The set of by-names is the union of names specified by by.x and by.y,
in your case: c(a, b).
I suppose that a case could be made that ?merge does not spell that
out sufficiently explicitly.


It does in 'Details' (and where else would there be such a detail?) 
E.g. in R 2.15.1:


 If the remaining columns in the data frames have any common names,
 these have ‘suffixes’ (‘.x’ and ‘.y’ by default) appended to
 try to make the names of the result unique.  If this is not
 possible, an error is thrown.

Note *remaining*, and read what comes before that.



Peter Ehlers

__
R-help@r-project.org mailing list
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.



--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
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] problem with convergence in mle2/optim function

2012-10-07 Thread Adam Zeilinger

Dear R Help,

Thank you to those who responded to my questions about mle2/optim 
convergence.  A few responders pointed out that the optim error seems to 
arise when either one of the probabilities P1, P2, or P3 become negative 
or infinite.  One suggested examining the exponential terms within the 
P1 and P2 equations.


I may have made some progress along these lines.  The exponential terms 
in the equations for P1 and P2 go to infinity at certain (large) values 
of t. The exponential terms can be found in lines 1, 5, and 7 in the P1 
and P2 expressions below.  Here is some example code:


###
# P1 and P2 equations
P1 - expression((p1*((-1 + exp(sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2)))*t))*((-mu2)*(mu2 - p1 + p2) +
  mu1*(mu2 + 2*p2)) - mu2*sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2))) -
  exp(sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)))*t)*
  mu2*sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2))) +
  2*exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2*t)*mu2*
  sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)/
  exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2*t)/(2*(mu2*p1 + mu1*(mu2 + p2))*
  sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)
P2 - expression((p2*((-1 + exp(sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2)))*t))*(-mu1^2 + 2*mu2*p1 +
  mu1*(mu2 - p1 + p2)) - mu1*sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2))) -
  exp(sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)))*t)*
  mu1*sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2))) +
  2*exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2*t)*mu1*
  sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)/
  exp((1/2)*(mu1 + mu2 + p1 + p2 + sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2*t)/(2*(mu2*p1 + mu1*(mu2 + p2))*
  sqrt((mu1 + mu2 + p1 + p2)^2 - 4*(mu2*p1 + mu1*(mu2 + p2)

# Vector of t values
tv - c(1:200)

# 'true' parameter values
p1t = 2; p2t = 2; mu1t = 0.001; mu2t = 0.001

# Function to calculate probabilities from 'true' parameter values
psim - function(x){
  params - list(p1 = p1t, p2 = p2t, mu1 = mu1t, mu2 = mu2t, t = x)
  eval.P1 - eval(P1, params)
  eval.P2 - eval(P2, params)
  P3 - 1 - eval.P1 - eval.P2
  c(x, matrix(c(eval.P1, eval.P2, P3), ncol = 3))
}
pdat - sapply(tv, psim, simplify = TRUE)
Pdat - as.data.frame(t(pdat))
names(Pdat) - c(time, P1, P2, P3)

matplot(Pdat[,-1], type = l, xlab = time, ylab = Probability,
col = c(black, brown, blue),
lty = c(1:3), lwd = 2, ylim = c(0,1))
legend(topright, c(P1, P2, P3),
   col = c(black, brown, blue),
   lty = c(1:3), lwd = 2)
Pdat[160:180,] # psim function begins to return NaN at t = 178

# exponential terms in P1 and P2 expressions are problematic
params - list(p1 = p1t, p2 = p2t, mu1 = mu1t, mu2 = mu2t, t = 178)

exp1 - expression(exp(sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2)))*t))
eval(exp1, params) # returns Inf at t = 178

exp2 - expression(exp((1/2)*(mu1 + mu2 + p1 + p2 +
  sqrt((mu1 + mu2 + p1 + p2)^2 -
  4*(mu2*p1 + mu1*(mu2 + p2*t))
eval(exp2, params) # also returns Inf at t = 178
##

The time step at which the exponential terms go to infinity depends on 
the values of the parameters p1, p2, mu1, mu2.  It seems that the 
convergence problems may be due to these exponential terms going to 
infinity.  Thus my convergence problem appears to be an overflow problem?


Unfortunately, I'm not sure where to go from here.  Due to the 
complexity of the P1 and P2 equations, there's no clear way to rearrange 
the equations to eliminate t from the exponential terms.


Does anyone have any suggestions on how to address this problem? 
Perhaps there is a way to bound p1, p2, mu1, and mu2 to avoid the 
exponential terms going to infinity?  Or bound P1 and P2?


Any suggestions would be greatly appreciated.

Adam Zeilinger



On 10/5/2012 3:06 AM, Berend Hasselman wrote:


On 05-10-2012, at 07:12, Adam Zeilinger wrote:


Hello R Help,

I am trying solve an MLE convergence problem: I would like to estimate four 
parameters, p1, p2, mu1, mu2, which relate to the probabilities, P1, P2, P3, of 
a multinomial (trinomial) distribution.  I am using the mle2() function and 
feeding it a time series dataset composed of four columns: time point, number 
of successes in category 1, number of successes in category 2, and number of 
success in category 3.  The column headers are: t, n1, n2, and n3.

The mle2() function converges occasionally, and I need to improve the rate of convergence when used 
in a stochastic simulation, with multiple stochastically generated datasets.  When mle2() does not 
converge, it returns an error: 

Re: [R] Robust regression for ordered data

2012-10-07 Thread Prof Brian Ripley

On 08/10/2012 00:37, Bert Gunter wrote:

Have you checked the Robust task view on CRAN?? Would seem that that
should have been the first place to look.


It is still a conceptual question.  I presume this means an ordered 
response, and then we need to know what is meant by 'regression'.


If you tell us precisely what robust method you want to know about, you 
may get help about whether it is available in R.   But I surmise that 
you need rather to be looking at ordinal regression (polr in MASS, for 
example), and you will not find that in the 'Robust' task view.   In the 
task view, 'robust' is  a technical term and I don't think 'Elko Fried' 
is using it in the sense the author of the task view is.




-- Bert

On Sun, Oct 7, 2012 at 3:30 PM, Eiko Fried tor...@gmail.com wrote:

Thank you Jeff! Please ignore the first of my two questions then, and
apologies for not making it clear that my second question was about R.

(2) Are there ways of using robust regressions with ordered data ... in
R?

Thank you


On 7 October 2012 18:26, Jeff Newmiller jdnew...@dcn.davis.ca.us wrote:


This does not appear to be a question about R. You should post in a list
or forum dedicated to discussing statistics theory, such as
stats.stackoverflow.com.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  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.

Eiko Fried tor...@gmail.com wrote:


I have two regressions to perform - one with a metric DV (-3 to 3), the
other with an ordered DV (0,1,2,3).

Neither normal distribution not homoscedasticity is given. I have a two
questions:

(1) Some sources say robust regression take care of both lack of normal
distribution and heteroscedasticity, while others say only of normal
distribution. What is true?
(2) Are there ways of using robust regressions with ordered data, or is
that only possible for metric DVs?

Thanks
Torvon

   [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.





 [[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
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.







--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@r-project.org mailing list
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.