Re: [R] variance components

2008-08-19 Thread Pablo G Goicoechea

   Dear John:
   Weir, BS 1996 Genetic Data Analysis II . Sinaur Associates, Sunderland, MA,;
   should get you started for methods in population genetics
   (otherreferencecouldbetheArlequin'smanual:
   [1]http://cmpg.unibe.ch/software/arlequin3/)
   However, you are probably interested in variance components for quantitative
   genetics (half-full sibs, mother-progeny correlations, etc.). In such a
   case,you   could   take   a   look   at   Lynch   &   Walsh   book
   [2]http://www.amazon.com/Genetics-Analysis-Quantitative-Traits-Michael/dp/08
   78934812
   Hope this helps
   Pablo
   John Sorkin escribió:

Please forgive the cross posting. I sent this to Medstats and have not received
 any response.

I am looking for a good written explanation of components of variance (a.k.a va
riance components), in particular as they are used in genetic analyses. Does an
yone have a suggestion? I am interested in books, articles and on-line material
. I intent to give the material to some of my students none of whom are statist
icians, they are all physicians or Ph.D.s in life sciences.
Thanks
John

John David Sorkin M.D., Ph.D.
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for th...{{dropped:6}}

__
[EMAIL PROTECTED] mailing list
[4]https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide [5]http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.



   --

   Pablo G Goicoechea

   Bioteknología Saila / Dpto Biotecnología

   NEIKER-Tecnalia

   Apdo 46

   01080 Vitoria-Gasteiz (SPAIN)

   Phone: +34 902 540 546 Fax: +34 902 540 547

   [EMAIL PROTECTED]

References

   1. http://cmpg.unibe.ch/software/arlequin3/
   2. 
http://www.amazon.com/Genetics-Analysis-Quantitative-Traits-Michael/dp/0878934812
   3. mailto:R-help@r-project.org
   4. https://stat.ethz.ch/mailman/listinfo/r-help
   5. http://www.R-project.org/posting-guide.html
   6. mailto:[EMAIL PROTECTED]
__
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] axis invertion

2007-11-22 Thread Juan Pablo Fededa
Hi all,

I want to invert the y axis of a plot, how can I do that in an easy way?
Thanks in advance,

Juan Pablo

__
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] more outrageous plotting

2007-11-22 Thread Juan Pablo Fededa
Dear Contributors:

I have the next matrix:

"X" "Y" "Z"

1 2  526
2 5  723
310 110
4 7  1110
5 9   34
6 8  778
7 1   614
8 4   876
9 6   249
10   3   14

I want to order the matrix from bigest Z (1110) to lower Z (14).
Then I want to asign a color scale vector from blue ( bigest Z) to
orange (lower Z), and then I want to make a plot with the X vs.Y
coordinates of the matrix, with the number correspondent to Z in every
point, each number coloured with the assigned colour scale colour.
Is this doable?
Thanks in advance again,



Juan Pablo

__
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] Rating R Helpers

2007-12-03 Thread Pablo G Goicoechea

   I'm just a R user who joined the list searching solution for a problem.
   I do not think rating helpers is a good idea. For once, they do it freely;
   no  need  to harrash (?) anybody. On the other hand, it could have the
   opposite  effect;  people afraid to get a bad rating do not post their
   potentially valid answers.
   But more importantly, the list is full with examples of how to accomplish
   the same result with different approaches. Some might be more elegant than
   others, but for sure they show R potentialities. And I have seen several
   corrections/discussions among old timers themselves.
   Packages reviews are another issue. But if anybody is going through all that
   work, why not to make the appropriate corrections to the packages? They are
   GPL, aren't they?
   Best
   Pablo
   Mark Kimpel escribió:

I'll throw one more idea into the mix. I agree with Bill that a rating
system for respondents is probably not that practical and of not the highest
importance. It also seems like a recipe for creating inter-personal problems
that the list doesn't need.

I do like Bill's idea of a review system for packages, which could be
incorporated into my idea that follows...

What I would find useful would be some sort of tagging system for messages.
I can't count the times I've remembered seeing a message that addresses a
question I have down the road but, when Googled, I can't find it. It would
be so nice, for example, to reliably be able to find all messages related to
a certain package or package function posted within the last X days. This
could be implemented as simply as asking posters to provide keywords at the
end of a message, but it would be great if they could somehow be pulled out
of a message and stored in a DB. For instance keywords could be surrounded
by a sequence of special characters, which a parser could then extract and
store in a DB along with the message.

Of course, this would be work to set up, but how many of our "experts" who
so kindly give of their time, get exasperated when similar questions keep
popping up on the list? Also, if we had a web-accessable DB, the responses,
not the responders, could be rated as to how well a reply takes care of an
issue. Thus, over time, a sort of auto-wiki could be born. I can think of
more uses for this as well. For example a developer could quickly check to
see what usability problems or suggestions have cropped up of on individual
package.

Mark

On Dec 1, 2007 2:21 AM, [1]<[EMAIL PROTECTED]> wrote:



This seems a little impractical to me.  People respond so much at random
and most only tackle questions with which they feel comfortable.  As
it's not a competition in any sense, it's going to be hard to rank
people in any effective way.  But suppose you succeed in doing so, then
what?

To me a much more urgent initiative is some kind of user online review
system for packages, even something as simple as that used by Amazon.com
has for customer review of books.

I think the need for this is rather urgent, in fact.  Most packages are
very good, but I regret to say some are pretty inefficient and others
downright dangerous.  You don't want to discourage people from
submitting their work to CRAN, but at the same time you do want some
mechanism that allows users to relate their experience with it, good or
bad.


Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):  +61 7 3826 7304
Mobile: +61 4 8819 4402
Home Phone: +61 7 3286 7700
[2]mailto:[EMAIL PROTECTED]
[3]http://www.cmis.csiro.au/bill.venables/

-Original Message-
From: [EMAIL PROTECTED] [[5]mailto:[EMAIL PROTECTED]
On Behalf Of Doran, Harold
Sent: Saturday, 1 December 2007 6:13 AM
To: R Help
Subject: [R] Rating R Helpers

Since R is open source and help may come from varied levels of
experience on R-Help, I wonder if it might be helpful to construct a
method that can be used to "rate" those who provide help on this list.

This is something that is done on other comp lists, like
[6]http://www.experts-exchange.com/.

I think some of the reasons for this are pretty transparent, but I
suppose one reason is that one could decide to implement the advise of
those with "superior" or "expert" levels. In other words, you can trust
the advice of someone who is more experienced more than someone who is
not. Currently, there is no way to discern who on this list is really an
R expert and who is not. Of course, there is R core, but most people
don't actually know who these people are (at least I surmise that to be
true).

If this is potentially useful, maybe one way to begin the development of
such ratings is to allow the original poster to "rate" the level of help
from those who responded. Maybe something like a very simple
qu

[R] vector generation

2008-01-17 Thread Juan Pablo Fededa
Dear Contributors:

I have the next vector:

"Z"

526
723
110
1110
34
778
614
249
14

I want to generate a vector containing the ratios of all the values
versus all the values of the z vector. I mean a vector containing the
values of 526/723, 526/110, and so on, 723/723, 723/110, and so on,
and so on.
Is this doable in a simple way??
Thanks in advance again,



Juan Pablo Fededa

__
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] vector generation

2008-01-24 Thread Juan Pablo Fededa
Dear Contributors:

I have the next vector:

"Z"

z = (526, 0.1, 110, 0.2, 34, 0.4, 614, 0.5, 1, 14, 15)


I want to generate a vector containing the values higher than 1
corresponding to the z vector, wich in this case will mean to generate the
next vector:

(526, 110, 34, 614, 14, 15)


If you have any clue on how to do that, I will be very glad to hear it!!
Thanks in advance again,

[[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] two histograms in the same graph

2008-01-24 Thread Juan Pablo Fededa
Dear Contributors:

I have two vectors x and z, and I want to display the histograms of both
vectors in the same graph, x in red bars, z in blue bars.
If you have any clue on how to do that, I will be very glad to hear it!!
Thanks in advance again,

Juan Pablo Fededa

[[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] How to create a chromosome location map by locus ID

2009-01-15 Thread Pablo G Goicoechea

__
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] How to create a chromosome location map by locus ID

2009-01-15 Thread Pablo G Goicoechea

Sorry list, I guess I sent an html reply.

Hi Sake:
If you do not find an answer within the list, MapChart will probably do 
what you want (without the fancy chromosomal bands, though). You can 
find it at


http://www.biometris.wur.nl/uk/Software/MapChart/

Hope this helps

Sake escribió:

Hi,

I'm trying to make a chromosomal map in R by using the locus. I have a list
of genes and their locus, and I want to visualise that so you can see if
there are multiple genes on a specific place on a chromosome. A example of
what I more or less want is below:
http://www.nabble.com/file/p21474206/untitled.JPG untitled.JPG 
The genes and locus are here:
http://www.nabble.com/file/p21474206/genlocus.csv genlocus.csv 
I've tried some things, but nothing worked like I would like it to see.

Maybe there is some kind of package that does this for you, but I did not
find it yet.
Thanx

Sake
  


--

*Pablo G Goicoechea*

Bioteknología Saila / /Dpto Biotecnología/

NEIKER-Tecnalia

Apdo 46

01080 Vitoria-Gasteiz (SPAIN)

Phone: +34 902 540 546 Fax: +34 902 540 547

pgoikoet...@neiker.net <mailto:pgoikoet...@neiker.net>

__
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] value transformations in a vector

2008-05-15 Thread Juan Pablo Fededa
Dear contributors:

I have vector A composed of numbers wich have values equal to 1 and
different to 1.
I want to transform de components with a value=1 to a component of value=0,
and those with a value different to1, to a value=1.
Then I want to take out the components=0.
Thanks in advance,


Juan Pablo

[[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] Problems with quantreg and party package in 2.6.2 ver

2008-02-27 Thread Pablo Fernández Alvarez
I've problem with this pkg:
- quantreg
- party

When i try to run this pkg under 2.6.2 (win 32). the system reports problems to 
reed the Rblas lib. (Not find the dynamic library links)

Any suggestions to solve the problem ...

tks, pablo.



--
Pablo Fco. Fernández Alvarez

__
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] tcltk issue remains

2008-04-07 Thread Pablo G Goicoechea
Hi Ingmar
Have you opened X11?

hope it helps
Pablo

Ingmar Visser escribió:
> Dear R-help,
>
> I'm trying to load the fGarch package and keep running into problems  
> with tcltk:
>
> After succesfully instaling fGarch (and dependencies) I get:
>
>  >library(fGarch)
> Loading required package: fBasics
> Loading required package: fImport
> Loading required package: fSeries
> Loading required package: robustbase
> Loading required package: fCalendar
> Loading required package: MASS
> Loading required package: fEcofin
> Loading required package: fUtilities
> Loading required package: RUnit
>
>   RUnit 0.4.17 loaded.
> Loading required package: spatial
> Loading required package: tcltk
> Loading Tcl/Tk interface ... Error in fun(...) : couldn't connect to  
> display ":0"
> Error : .onLoad failed in 'loadNamespace' for 'tcltk'
> Error: package 'tcltk' could not be loaded
>
> Then, after checking the OSX faq, I get
>
>  >Sys.putenv("DISPLAY"=":0")
> Warning message:
> 'Sys.putenv' is deprecated.
> Use 'Sys.setenv' instead.
> See help("Deprecated")
>
> But the problem remains:
>
> Sys.setenv("DISPLAY"=":0")
>  > library(fGarch)
> Loading required package: fBasics
> Loading required package: fImport
> Loading required package: fSeries
> Loading required package: fCalendar
> Loading required package: fEcofin
> Loading required package: fUtilities
> Loading required package: tcltk
> Loading Tcl/Tk interface ... Error in fun(...) : couldn't connect to  
> display ":0"
> Error : .onLoad failed in 'loadNamespace' for 'tcltk'
> Error: package 'tcltk' could not be loaded
>
> I am not sure what the tcltk interface does and what I need it for ...
> Also, tcltk is not listed in the package list but tcltk2 is so I'm  
> not sure which package is being loaded
> here?
>
> What can I do about this?
>
> Best, Ingmar
>
>  > sessionInfo()
> R version 2.6.2 (2008-02-08)
> powerpc-apple-darwin8.10.1
>
> locale:
> en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
>
> attached base packages:
> [1] stats graphics  grDevices utils datasets  methods   base
>
> other attached packages:
> [1] spatial_7.2-40   RUnit_0.4.17 MASS_7.2-40  robustbase_0.2-8
>
>
>
> Ingmar Visser
> Department of Psychology, University of Amsterdam
> Roetersstraat 15
> 1018 WB Amsterdam
> The Netherlands
> t: +31-20-5256723
>
>
>
>   [[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] filtering a simple matrix

2009-02-22 Thread Juan Pablo Fededa
Hi all,

I have the next matrix:


ab c

1223
2342
3054
4523
5022
6721
7120
8919

I want to filter the rows with the values of b higher than 1 in a way that
leaves me the next matrix:


ab c

1223
2342
4523
6721
8919


Thanks in advance,


Juan

[[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] Interpreting GLM coefficients

2009-03-06 Thread Pablo Pita Orduna
Month6 Hours:Month7
 -6.805803e-03 7.971549e+00  
2.627090e+00 1.403430e+00 7.747360e-01  
  5.163810e-01 3.732549e-01 2.827511e-01
  Hours:Month8 Hours:Month9 
Hours:Month10Hours:Month11 Kind.Geographic1:Fishers  
Kind.Geographic2:Fishers Kind.Geographic3:Fishers   
Zone.21:Fishers
  2.091230e-01 1.057001e-01  
1.159929e-01   NA-3.422994e-02  
 -3.421851e-03   NA-3.802354e-03
   Zone.22:Fishers  Zone.23:Fishers   
Zone.24:Fishers   Fishers:Month1   Fishers:Month2   
 Fishers:Month3   Fishers:Month4   Fishers:Month5
  1.618358e-05 4.197350e-04 
-8.773088e-05 7.806815e-01 2.509529e-01 
 1.280752e-01 7.520139e-02 5.370220e-02
Fishers:Month6   Fishers:Month7
Fishers:Month8   Fishers:Month9  Fishers:Month10
 Fishers:Month11
  3.786759e-02 2.936135e-02  
2.381810e-02 2.422438e-02   NA  
NA



I would like to know if it is possible to extract the intercepts and  
the slopes for Year and Year^2 for this Model2.


Thank you very much for your help.
____
Pablo Pita Orduna
Grupo de Recursos Marinos y Pesquerías.
Universidade de A Coruña. Campus da Zapateira s/n. E-15071. A Coruña, Spain.
Tel. +34(981) 167000 ext. 2204 Fax. +34(981) 167065.
www.fismare.net/verdeprofundo






Correo enviado usando el servicio de Webmail de la UDC.

__
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] Interpreting GLM coefficients

2009-03-10 Thread Pablo Pita Orduna
Thank you very much!

It helps a lot. You are right about the NA´s in the coefficients, the model 
needs some simplification.

Thank you again.
---
Pablo Pita Orduna
Grupo de Recursos Marinos y Pesquerías.
Universidade de A Coruña. Campus da Zapateira s/n. E-15071. A Coruña, Spain.
Tel. +34(981) 167000 ext. 2204 Fax. +34(981) 167065.
www.fismare.net/verdeprofundo
www.recursosmarinos.net
  - Original Message - 
  From: joris meys 
  To: Pablo Pita Orduna 
  Cc: r-help@r-project.org ; jfre...@udc.es ; ppitaord...@gmail.com 
  Sent: Saturday, March 07, 2009 12:28 AM
  Subject: Re: [R] Interpreting GLM coefficients


  One thing I notice immediately is a number of NA values for your 
coefficients. If I were you, I would try a model with less parameters, and use 
the anova() function to compare models, to see if the extra terms really 
improve the model.
  e.g. 
  fit1 <- glm(Y~X1+X2+X3,...)
  fit2 <- glm(Y~X1+X2+X3+X1:X2,...)
  anova(fit1, fit2, test="F") 

  If you checked all these, understanding the interaction terms will be most 
easy if you normalized your numeric data before the analysis. For the 
interpretations, you just fill in some values to get an idea. For example :

  given the model : Y= a+b1*X1+b2*X2+b3*X1*X2

  Say X1 and X2 are numeric :
  interpretation of the main term : "Y increases with b2 for an increase of 1 
unit in X2, given X1 is average".
  interpretation of the interaction term : "For an X1 value of n units from the 
mean, X2 increases with b2+n*b3" (n is negative when value is lower than the 
mean).
  In a Y ~ X2 plot, you can make this visible by plotting 3 different functions 
: one for a low X1 value, one for an average X1 value and one for a high X1 
value. This gives you an indication of the effect of X1 on X2.

  for an interaction between a categorical terms or a categorical and a 
numerical, you follow exact the same reasoning, but keep in mind that the 
reference level represents a 0, and the mentioned level represents a 1. Fill in 
the values in the equation, and you can understand the meaning of the terms. 
Then again, you can plot a seperate function Y~X1 for every level of a certain 
factor.

  This isn't a straight answer on your question, but I'm afraid there is none. 
I hope this helps you with building your model.

  Kind regards.
  Joris


  On Fri, Mar 6, 2009 at 11:04 PM, Pablo Pita Orduna  wrote:

Hi all,

I´m fitting GLM´s and I can´t interprete the coefficients when I run a 
model with interaction terms.

When I run the simpliest model there is no problem:

Model1<-glm (Fishes ~ Year + I(Year^2) + Kind.Geographic + Kind.Fishers + 
Zone.2 + Hours + Fishers + Month, family = poisson(log)) # Fishes, Year, Hours, 
and Fishers are numeric, Kind.Geographic, Kind.Fishers, Zone.2 and Month are 
factors with 4, 3, 5 and 12 levels respectively.

Model1$coefficients (whith Helmert contrasts):

  (Intercept) Year   IYear^2 Kind.Geographic1 
Kind.Geographic2 Kind.Geographic3Kind.Fishers1Kind.Fishers2  
Zone.21  Zone.22  Zone.23  Zone.24
 -4.416915e+02 4.758455e-01-1.270986e-04-5.436199e-01
-1.068809e-01-1.498580e-01 2.958462e-01 1.316589e-01
-1.328204e-01-1.605802e-01 5.281869e-03 7.422885e-02
Hours  Fishers   Month1   Month2 
Month3   Month4   Month5   Month6 Month7
   Month8   Month9  Month10
 9.772076e-02-2.709955e-03-1.586887e-01-1.887837e-02
-5.183241e-03 5.870942e-02 7.075386e-02 2.061223e-02 
7.372268e-03-1.204835e-02-5.047994e-03 2.441498e-02
  Month11
 -5.665261e-03

So I can write, for example:

y = -4.416915e+02 + -1.270986e-04*x^2 + 4.758455e-01*x # And add this 
function to a plot(Year,Fishes).

My problem is to understand the coefficients for the model with interaction:

Model2<-glm(Fishes ~ Year + I(Year^2) + Kind.Geographic + Kind.Fishers + 
Zone.2 + Hours + Fishers + Month + Year:Kind.Geographic + Year:Kind.Fishers + 
Year:Zone.2 + Year:Hours + Year:Fishers + Year:Month + Kind.Geographic:Hours + 
Kind.Fishers:Hours + Zone.2:Hours + Hours:Fishers + Hours:Month 
+Kind.Geographic:Fishers + Zone.2:Fishers + Fishers:Month , poisson (log))

Model2$coefficients (with Helmert contrast):

  (Intercept) YearI(Year^2) 
Kind.Geographic1 Kind.Geographic2 Kind.Geographic3  
  Kind.Fishers1Kind.Fishers2
 1.641473e+03-1.748703e+00 4.664752e-04 
   -6.721427e+00 1.856033e+01  -3.762727e-02
 2.903564e+0

[R] matrix filtering and reordering

2009-04-07 Thread Juan Pablo Fededa
I have two matrixes,

red:

a 123
c 200
d 400
e 650
g 127
f 100

and blue:

a 10
b 20
c 30
d 40
e 50
f 60
g 70

is there any easy way to get the next matrix:

a 10 123
b 20 0
c 30 200
d 40 400
e 50 650
f 60 100
g 70 127

i.e. to add in the third column of blue the [,2] values of red corresponding
to the file with same [x,1] value of blue, adding a cero in the case that
there is no
[x,1] corresponding value in the red matrixes (case for row 2 of blue).
Thanks in advance,


juan



Juan Pablo Fededa

[[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] matrix merge problem

2009-04-14 Thread Juan Pablo Fededa
Dear r-help contributors,

I have two questions:

first:

I have a matrix A and a vector B.
I want to make a new matrix C, which is made of the rows of A having a value
included in B.

Second:

I have two matrixes A and B, of different dimensions.
B has unique values in column 2 and A has not unique values on column 2.
I want to merge this two matrixes by the values in the columns 2 of B and 2
of A in such a way that the resulting matrix will be C:


A:

1 2
2 2
3 3
4 3
5 4
6 4
7 5
8 5


B:

1 2  x c d
2 3  y f  g

C:

1 2  x c d
2 2  x c d
3 3  y f  g
4 3  y f  g
5 4 NA NA
6 4 NA NA
7 5 NA NA
8 5 NA NA


Can you help me?


Many thanks in advance.

[[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] how to partitioning a clustered heatmap

2009-08-07 Thread Fededa Juan Pablo
Hello all,

I'm doing heatmap.2 graphics of matrix x with hclust clustering in the rows, as 
an argument in heatmap.2 .
The problem is that the heatmap contains 1000 genes, and I want to cut it in 
several pieces, but after the clustering.
If I use x[1:100,] as delimiting argument for the first 100 clustered 
rows(genes) in the matrix, it doesn't work, it takes the 100 first rows in the 
matrix and does the clustering over them, and not first the clustering over the 
1000 genes and then graph the first 100 rows of the clustered matrix.
The entire argument of heatmap I'm using is something like this:

heatmap.2(x, scale="none", cexRow=0.1, keysize=0.8, hclustfun = hclust, 
sepcolor="none",Colv=FALSE, dendrogram="row", 
trace=c("none"),density.info=c("none"))

If you can help me, will be great.
Thanks in advance,


juan



Juan Pablo Fededa
Institute of Biochemistry-ETH Zurich
HPM,D11.1
Schafmattstrasse 18
CH-8093, Zurich
Switzerland
+41 44 633 60 26  phone
+41 44 632 12 69 fax
jpfed...@bc.biol.ethz.ch
www.lmc.ethz.ch/IBC/

__
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] Equivalent of Mathematica's Apply

2008-06-24 Thread Juan Pablo Romero Méndez
Hello,

Is there some equivalent function in R of Mathematica's "Apply"

i.e.

Apply[ f, g[a,b]] ==> f[a,b]


In concret, I have a matrix of indexes:

> ind = cbind(1:5, 1:5+5)

> ind

 [,1] [,2]
[1,]16
[2,]27
[3,]38
[4,]49
[5,]5   10


and I'd like to extract sequences 1:6, 2:7, 3:8, ..., 5:10  from a vector x.

What would be the most compact way of achieving this?

I've tried

 sapply(1:5, function(i) x[ind[i,1] : ind[i,2]])


Although

 sapply(1:5, function(i) x[seq(ind[i,])])

would be better (if it worked).

Regards,

  Juan Pablo

__
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] Equivalent of Mathematica's Apply

2008-06-24 Thread Juan Pablo Romero Méndez
Thanks all!

  JP

On Tue, Jun 24, 2008 at 3:30 PM, Franz Mueter <[EMAIL PROTECTED]> wrote:
> Try
>
>> apply(ind, 1, function(i) x[i[1]:i[2]])
>
> which returns a matrix if all sequences are the same length, a list
> otherwise
>
> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Juan Pablo Romero Méndez
> Sent: Tuesday, June 24, 2008 11:51 AM
> To: [EMAIL PROTECTED]
> Subject: [R] Equivalent of Mathematica's Apply
>
> Hello,
>
> Is there some equivalent function in R of Mathematica's "Apply"
>
> i.e.
>
> Apply[ f, g[a,b]] ==> f[a,b]
>
>
> In concret, I have a matrix of indexes:
>
>> ind = cbind(1:5, 1:5+5)
>
>> ind
>
> [,1] [,2]
> [1,]16
> [2,]27
> [3,]38
> [4,]49
> [5,]5   10
>
>
> and I'd like to extract sequences 1:6, 2:7, 3:8, ..., 5:10  from a vector x.
>
> What would be the most compact way of achieving this?
>
> I've tried
>
>  sapply(1:5, function(i) x[ind[i,1] : ind[i,2]])
>
>
> Although
>
>  sapply(1:5, function(i) x[seq(ind[i,])])
>
> would be better (if it worked).
>
> Regards,
>
>  Juan Pablo
>
> __
> 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] Parallel R

2008-06-28 Thread Juan Pablo Romero Méndez
Hello,

The problem I'm working now requires to operate on big matrices.

I've noticed that there are some packages that allows to run some
commands in parallel. I've tried snow and NetWorkSpaces, without much
success (they are far more slower that the normal functions)

My problem is very simple, it doesn't require any communication
between parallel tasks; only that it divides simetricaly the task
between the available cores. Also, I don't want to run the code in a
cluster, just my multicore machine (4 cores).

What solution would you propose, given your experience?

Regards,

  Juan Pablo

__
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] Parallel R

2008-06-29 Thread Juan Pablo Romero Méndez
Thanks!

It turned out that Rmpi was a good option for this problem after all.

Nevetheless, pnmath seems very promising, although it doesn't load in my system:


> library(pnmath)
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared library
'/home/jpablo/extra/R-271/lib/R/library/pnmath/libs/pnmath.so':
  libgomp.so.1: shared object cannot be dlopen()ed
Error: package/namespace load failed for 'pnmath'


I find it odd, because  libgomp.so.1 is in /usr/lib, so R should find it.


  Juan Pablo


On Sun, Jun 29, 2008 at 1:36 AM, Martin Morgan <[EMAIL PROTECTED]> wrote:
> "Juan Pablo Romero Méndez" <[EMAIL PROTECTED]> writes:
>
>> Hello,
>>
>> The problem I'm working now requires to operate on big matrices.
>>
>> I've noticed that there are some packages that allows to run some
>> commands in parallel. I've tried snow and NetWorkSpaces, without much
>> success (they are far more slower that the normal functions)
>
> Do you mean like this?
>
>> library(Rmpi)
>> mpi.spawn.Rslaves(nsl=2) # dual core on my laptop
>> m <- matrix(0, 1, 1000)
>> system.time(x1 <- apply(m, 2, sum), gcFirst=TRUE)
>   user  system elapsed
>  0.644   0.148   1.017
>> system.time(x2 <- mpi.parApply(m, 2, sum), gcFirst=TRUE)
>   user  system elapsed
>  5.188   2.844  10.693
>
> ? (This is with Rmpi, a third alternative you did not mention;
> 'elapsed' time seems to be relevant here.)
>
> The basic problem is that the overhead of dividing the matrix up and
> communicating between processes outweighs the already-efficient
> computation being performed.
>
> One solution is to organize your code into 'coarse' grains, so the FUN
> in apply does (considerably) more work.
>
> A second approach is to develop a better algorithm / use an
> appropriate R paradigm, e.g.,
>
>> system.time(x3 <- colSums(m), gcFirst=TRUE)
>   user  system elapsed
>  0.060   0.000   0.088
>
> (or even faster, x4 <- rep(0, ncol(m)) ;)
>
> A third approach, if your calculations make heavy use of linear
> algebra, is to build R with a vectorized BLAS library; see the R
> Installation and Administration guide.
>
> A fourth possibility is to use Tierney's 'pnmath' library mentioned in
> this thread
>
> https://stat.ethz.ch/pipermail/r-help/2007-December/148756.html
>
> The README file needs to be consulted for the not-exactly-trivial (on
> my system) task of installing the package. Specific functions are
> parallelized, provided the length of the calculation makes it seem
> worth-while.
>
>> system.time(exp(m), gcFirst=TRUE)
>   user  system elapsed
>  0.108   0.000   0.106
>> library(pnmath)
>> system.time(exp(m), gcFirst=TRUE)
>   user  system elapsed
>  0.096   0.004   0.052
>
> (elapsed time about 2x faster). Both BLAS and pnmath make much better
> use of resources, since they do not require multiple R instances.
>
> None of these approaches would make a colSums faster -- the work is
> just too small for the overhead.
>
> Martin
>
>> My problem is very simple, it doesn't require any communication
>> between parallel tasks; only that it divides simetricaly the task
>> between the available cores. Also, I don't want to run the code in a
>> cluster, just my multicore machine (4 cores).
>>
>> What solution would you propose, given your experience?
>>
>> Regards,
>>
>>   Juan Pablo
>>
>> __
>> 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.
>
> --
> Martin Morgan
> Computational Biology / Fred Hutchinson Cancer Research Center
> 1100 Fairview Ave. N.
> PO Box 19024 Seattle, WA 98109
>
> Location: Arnold Building M2 B169
> Phone: (206) 667-2793
>

__
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] Parallel R

2008-07-09 Thread Juan Pablo Romero Méndez
Just out of curiosity, what system do you have?

These are the results in my machine:

> system.time(exp(m), gcFirst=TRUE)
   user  system elapsed
   0.520.040.56
> library(pnmath)
> system.time(exp(m), gcFirst=TRUE)
   user  system elapsed
  0.660   0.016   0.175


  Juan Pablo


>
>> system.time(exp(m), gcFirst=TRUE)
>   user  system elapsed
>  0.108   0.000   0.106
>> library(pnmath)
>> system.time(exp(m), gcFirst=TRUE)
>   user  system elapsed
>  0.096   0.004   0.052
>
> (elapsed time about 2x faster). Both BLAS and pnmath make much better
> use of resources, since they do not require multiple R instances.
>

__
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] problems installing rJava

2008-05-11 Thread Juan Pablo Romero Méndez
Hello,

I'm having trouble installing rJava on R-2.6.1 / Suse10.3.

What could be wrong?


Regards,


  Juan Pablo



This is the output of

> install.packages("rJava", dependencies=T)


--- Please select a CRAN mirror for use in this session ---
Loading Tcl/Tk interface ... done
probando la URL 'http://cran.stat.ucla.edu/src/contrib/rJava_0.5-1.tar.gz'
Content type 'application/x-tar' length 230806 bytes (225 Kb)
URL abierta
==
downloaded 225 Kb

/usr/lib/R/library
* Installing *source* package 'rJava' ...
checking for gcc... gcc -std=gnu99
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
configure: checking whether gcc -std=gnu99 supports static inline...
yes
checking Java support in R... present:
interpreter : '/usr/bin/java'
archiver: '/usr/bin/jar'
compiler: '/usr/bin/javac'
header prep.: '/usr/bin/javah'
cpp flags   : '-I/usr/lib/jvm/java-1.5.0-sun-1.5.0_update15/jre/../include
-I/usr/lib/jvm/java-1.5.0-sun-1.5.0_update15/jre/../include/linux'
java libs   : '-L/usr/lib/jvm/java-1.5.0-sun-1.5.0_update15/jre/lib/i386/server
-L/usr/lib/jvm/java-1.5.0-sun-1.5.0_update15/jre/lib/i386
-L/usr/lib/jvm/java-1.5.0-sun-1.5.0_update15/jre/../lib/i386 -ljvm'
checking whether JNI programs can be compiled... yes
checking JNI data types... configure: error: One or more JNI types
differ from the corresponding native type. You may need to use
non-standard compiler flags or a different compiler in order to fix
this.
ERROR: configuration failed for package 'rJava'
** Removing '/usr/lib/R/library/rJava'

The downloaded packages are in
/tmp/RtmpNOU9fz/downloaded_packages
Updating HTML index of packages in '.Library'
Warning message:
In install.packages("rJava", dependencies = T) :
  installation of package 'rJava' had non-zero exit status
>

__
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.