[R] Jordan Form of a matrix

2011-11-11 Thread Arnau Mir Torres
Hello.

Is it possible to find the Jordan Form of a matrix with R?


Arnau.

Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau@uib.es
URL: http://dmi.uib.es/~arnau

__
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 does Sweave write to a file?

2010-12-09 Thread Arnau Mir Torres
Hello.

I need that Sweave writes R output to a file. To do it, I put the following 
into the foo.Rnw file:


\documentclass{article}
\usepackage{Sweave}
\begin{document}

...

echo=F=
x - rnorm(100)
y - rnorm(100)
sink(foo.txt)
summary(lm(y~x))
sink()
@

...

\end{document}


When I run:

R CMD Sweave foo.Rnw

R responses:

Warning message:
In sink() : no sink to remove, 

and It doesn't work. Somebody knows how I can fix it?

Thanks,

Arnau.




Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau@uib.es
URL: http://dmi.uib.es/~arnau

__
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] compute the associate vector of distances between leaves in a binary non-rooted tree

2010-06-02 Thread Arnau Mir Torres
Hello.

I'd like to compute the associate vector of distances between leaves in a 
binary non-rooted tree. The definition of a distance between two leaves in a 
binary non-rooted tree is the number of edges in the path joining the two 
leaves.
I've tried the ape package but I'm unable to find this vector. 
For example, using rtree(5,rooted=F) I've obtained the following tree:

$edge
 [,1] [,2]
[1,]67
[2,]71
[3,]78
[4,]82
[5,]83
[6,]64
[7,]65

$tip.label
[1] t4 t3 t2 t1 t5

$edge.length
[1] 0.9126727 0.2765674 0.4996832 0.7904400 0.8508797 0.8174133 0.9027958

$Nnode
[1] 3


My question is: how to compute the vector of distances between the 5 leaves. 
This vector is in this case:
v=(d(t1,t2),d(t1,t3),d(t1,t4),d(t1,t5),d(t2,t3),d(t2,t4),d(t2,t5),d(t3,t4),d(t3,t5),d(t4,t5))=(4,4,3,2,2,3,4,3,4,3).


Thanks in advance,

Arnau.

Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau@uib.es
URL: http://dmi.uib.es/~arnau









__
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] duncan test in R

2009-09-22 Thread Arnau Mir Torres

Hello.

Sorry if the question I'm asking is trivial but I'm unable to find the  
answer.


How can I make a duncan test of multiple rank in R? That is, the  
designed test to see which mean levels are different in an one factor  
ANOVA.


Thanks in advance,

Arnau.

Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau@uib.es
URL: http://dmi.uib.es/~arnau

__
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] Sweave and accents

2009-06-09 Thread Arnau Mir Torres

Hello.

I want to write my notes in Sweave in my own language (spanish). But  
my language has accents and when I run Sweave in R to translate my Snw  
file into the tex file the accents are translated into unrecognizable  
characters.

For example, the word camión (truck) is translated into camión

Somebody knows how can I do it?

One solution I don't like is using a perl program to substitute my  
accented letters into normal accents in LaTeX in my Snw file before  
running Sweave.  That is:


á - \'a
é - \'e
...

The problem is when I run the spelling program, it doesn't work  
because the spelling doesn't recognize the words with normal accents.


There is a solution but it is tedious:

1)  substitute the accented letters letter into normal accents in  
LaTeX.

2) run Sweave and create the tex file.
3) subtitute the normal accents into the accented letters in the tex  
file.



My question is:
Is there another way to do it?


Arnau.


Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau@uib.es
URL: http://dmi.uib.es/~arnau









__
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] queues

2009-02-10 Thread Arnau Mir Torres

Hello.

Somebody knows some R package to work with queues simulation?



Thanks in advance,

Arnau.

Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: arnau@uib.es
URL: http://dmi.uib.es/~arnau

__
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] help about how can R compute AIC?

2008-10-14 Thread Arnau Mir Torres


El 14/10/2008, a las 18:05, Martin Maechler escribió:


AMT == Arnau Mir Torres [EMAIL PROTECTED]
   on Tue, 14 Oct 2008 17:13:01 +0200 writes:
AMT == Arnau Mir Torres [EMAIL PROTECTED]
   on Tue, 14 Oct 2008 17:13:01 +0200 writes:


   AMT Hello.

   AMT I need to know how can R compute AIC when I study a  
regression model?

   AMT For example, if I use these data:
   AMT growth tannin
   AMT 1 12  0
   AMT 2 10  1
   AMT 3  8  2
   AMT 4 11  3
   AMT 5  6  4
   AMT 6  7  5
   AMT 7  2  6
   AMT 8  3  7
   AMT 9  3  8
   AMT and I do
   AMT model - lm (growth ~ tannin)
   AMT AIC(model)

   AMT R responses:
   AMT 38.75990

   AMT I know the following formula to compute AIC:
   AMT AIC= -2*log-likelihood + 2*(p+1)

   AMT In my example, it would be:
   AMT AIC=-2*log-likelihood + 2*2
   AMT but I don't know how R computes log-likelihood:

   AMT logLik(model)
   AMT 'log Lik.' -16.37995 (df=3)

and so?


What is the formula to compute logLik? I don't know how to compute by  
hand logLik(model) and obtain -16.37995.



Arnau.



Hint: Your only problem is that your 'p' is wrongly off by one.
2nd Hint: sigma is a parameter, too




Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: [EMAIL PROTECTED]
URL: http://dmi.uib.es/~arnau









__
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 about how can R compute AIC?

2008-10-14 Thread Arnau Mir Torres

Hello.

I need to know how can R compute AIC when I study a regression model?
For example, if I use these data:
  growth tannin
1 12  0
2 10  1
3  8  2
4 11  3
5  6  4
6  7  5
7  2  6
8  3  7
9  3  8
and I do
model - lm (growth ~ tannin)
AIC(model)

R responses:
38.75990

I know the following formula to compute AIC:
AIC= -2*log-likelihood + 2*(p+1)

In my example, it would be:
AIC=-2*log-likelihood + 2*2
but I don't know how R computes log-likelihood:

logLik(model)
'log Lik.' -16.37995 (df=3)


Thanks,

Arnau.

Arnau Mir Torres
Edifici A. Turmeda
Campus UIB
Ctra. Valldemossa, km. 7,5
07122 Palma de Mca.
tel: (+34) 971172987
fax: (+34) 971173003
email: [EMAIL PROTECTED]
URL: http://dmi.uib.es/~arnau

__
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 about random generation of a Normal distribution of several variables

2008-07-05 Thread Arnau Mir Torres

Hello.

Somebody knows how can I generate a set of n random vectors  of a  
normal distribution of several variables?
For example, I want to generate n=100 random vectors of two dimensions  
for a normal with mean c(0,1)  and  variance matrix:   
matrix(c(2,1,1,3),2,2).


Thanks in advance,

Arnau.

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