[R] LME: internal workings of QR factorization --repost

2007-04-12 Thread Izmirlian, Grant \(NIH/NCI\) [E]

Hi:

I've been reading Computational Methods for Multilevel Modeling by Pinheiro 
and Bates, 
the idea of embedding the technique in my own c-level code. The basic idea is 
to rewrite 
the joint density in a form to mimic a single least squares problem conditional 
upon the 
variance parameters.  The paper is fairly clear except that some important 
level of detail 
is missing. For instance, when we first meet Q_(i):

/\  / \
| Z_i X_i   y_i  |  | R_11(i) R_10(i) c_1(i)  |
|| = Q_(i)  | |
| Delta   0 0|  |   0 R_00(i) c_0(i)  |
\/  \ /

the text indicates that the Q-R factorization is limited to the first q columns 
of the 
augmented matrix on the left.  If one plunks the first q columns of the 
augmented matrix 
on the left into a qr factorization, one obtains an orthogonal matrix Q that is 
(n_i + q) x q 
and a nonsingular upper triangular matrix R that is q x q.  While the text 
describes R as a 
nonsingular upper triangular q x q, the matrix Q_(i) is described as a square 
(n_i + q) x (n_i + q) 
orthogonal matrix.  The remaining columns in the matrix to the right are 
defined by applying 
transpose(Q_(i)) to both sides.  The question is how to augment my Q which is 
orthogonal (n_i + q) x q  
with the missing (n_i + q) x n_i portion producing the orthogonal square matrix 
mentioned in the text?  
I tried appending the n_i x n_i identity matrix to the block diagonal, but this 
doesn't work as the 
resulting likelihood is insensitive to the variance parameters.

Grant Izmirlian
NCI

__
[EMAIL PROTECTED] 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] LME: internal workings of QR factorization

2007-04-12 Thread Izmirlian, Grant \(NIH/NCI\) [E]
Hi:

I've been reading Computational Methods for Multilevel Modeling by Pinheiro 
and Bates, the idea of embedding the technique in my own c-level code. The 
basic idea is to rewrite the joint density in a form to mimic a single least 
squares problem conditional upon the variance parameters.  The paper is fairly 
clear except that some important level of detail is missing. For instance, when 
we first meet Q_(i):

/\  / \
| Z_i X_i   y_i  |  | R_11(i) R_10(i) c_1(i)  |
|| = Q_(i)  | |
| Delta   0 0|  |   0 R_00(i) c_0(i)  |
\/  \ /

the text indicates that the Q-R factorization is limited to the first q columns 
of the augmented matrix on the left.  If one plunks the first
q columns of the augmented matrix on the left into a qr factorization, one 
obtains an orthogonal matrix Q that is (n_i + q) x q and a nonsingular upper 
triangular matrix R that is q x q.  While the text describes R as a nonsingular 
upper triangular q x q, the matrix Q_(i) is described as a square (n_i + q) x 
(n_i + q) orthogonal matrix.  The remaining columns in the matrix to the right 
are defined by applying transpose(Q_(i)) to both sides.  The question is how to 
augment my Q which is orthogonal (n_i + q) x q  with the missing (n_i + q) x 
n_i portion producing the orthogonal square matrix mentioned in the text?  I 
tried appending the n_i x n_i identity matrix to the block diagonal, but this 
doesn't work as the resulting likelihood is insensitive to the variance 
parameters.

Grant Izmirlian
NCI

__
[EMAIL PROTECTED] 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] Adding .R to source file keeps R from reading it?

2006-09-22 Thread Izmirlian, Grant \(NIH/NCI\) [E]
So...are you trying to modify a contributed package by adding a *.R file
to the 'R' subdirectory in the package?  One thing to consider besides
the previous tip is that the package might be using a NAMESPACE, which
lives in the package root directory (one directory up from the 'R' 
subdirectory).  If so, then you must add the name of your function
to the argument list of the call to 'export' in the NAMESPACE file

e.g.  export(sortgenes, pvalues, MyFunction)


-Original Message-
From: John Tillinghast [mailto:[EMAIL PROTECTED]
Sent: Thu 9/21/2006 9:55 PM
To: r-help@stat.math.ethz.ch
Subject: Re: [R] Adding .R to source file keeps R from reading it?
 
Yes, this was exactly the problem: I was using the unzipped package, not the
source.
Now it works!

-- Forwarded message --
From: Deepayan Sarkar [EMAIL PROTECTED]
Date: Sep 21, 2006 2:58 PM
Subject: Re: [R] Adding .R to source file keeps R from reading it?
To: John Tillinghast [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch

On 9/21/06, John Tillinghast [EMAIL PROTECTED] wrote:
 Hi,

 I'm updating the LMGene package from Bioconductor. Writing R Extensions
 suggests
 that all source files (the ones in the R directory) have a .R ending, so I
 added it to the (one) source file.
 The next time I installed and ran R, R didn't understand any of the
 functions.
 I tried various things and eventually went back to the file and dropped
the
 .R ending, installed, ran R. It worked!
 For purposes of distributing the package, do I want to leave the name
 without the .R, or add the .R and change something else?

I'm guessing that the source you are working on has been obtained by
unzipping the windows binary zip file. Despite appearances, that is
not the source code. For the proper source code, download the file
that's marked as source. In this case,

http://bioconductor.org/packages/1.8/bioc/html/LMGene.html

clearly labels the following as Source (and the corresponding zip
file as Windows Binary)

http://bioconductor.org/packages/1.8/bioc/src/contrib/LMGene_1.0.0.tar.gz

This likely answers your other question as well.

-Deepayan

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] Geometrical Interpretation of Eigen value and Eigen vector

2006-08-13 Thread Izmirlian, Grant \(NIH/NCI\) [E]
Ok, I had a look at it. It seems like awefully far to dig for the main point 
which is easily 
summarized in a few sentences.

If we super-impose the pre-image and image spaces (plot the input and output in 
the same
picture), then in 1 dimension, a linear function, say 'a x', takes its input, 
x, and stretches
it by a factor |a|. If 'a' is negative, then the direction that 'x' points is 
reversed.

Understanding several dimensions, as is usually the case, requires us to refine 
our
understanding of the 1-dimensional case.  In several dimensions, a linear 
function, 
say 'A x' (where 'A' is an m by m matrix and 'x' is an 'm' vector) will result 
in the stretching
of the input, 'x', along the direction its pointing, by a factor 'a'. However, 
this is the case
_only_ if 'x' lies in one of the 'characteristic directions' corresponding to 
'A'. Since 'A'
is an m by m matrix, there will be at most m such 'characteristic directions'.  
Each of the
characteristic directions has its associated stretching factor.  The 
characteristic directions
are called eigenvectors and the corresponding stretching factors are called 
eigenvalues.

Think about what this means in 1-dimension (hint: there's only one dimension so 
only
one possible direction).

The number of linearly independent characteristic directions (eigenvectors) is 
called the
rank of the matrix, A.  If you understand the concept of 'basis' then you know 
that any
m vector can be expressed in terms of the basis of eigenvectors of 'A' (that is 
unless A is not
of 'full rank' and has less than m linearly independent eigenvectors, in which 
case we decomponse
'x' into two orthogonal components, one as a linear combination of the 
eigenvectors of A and the other
gets mapped to 0 by A.)

Thus to each input 'x' is assigned an output 'y' which is the sum of 
coefficients in the eigenvector
basis representation of 'x' times corresponding eigenvalues.  This can be 
understood as the  
diagonalization of 'A'.  By the way, the referenced page was in error because 
the singular value
decomposition (I think the page actually called it the single value 
decomposition...free translation(s).com 
anyone) is not the same thing as the diagonalization.

There, it took a little more than a few sentences, but at least by the close of 
the second paragraph
one gets the basic idea.

Now, in closing, Arun, please spend some time thinking about the answer to your 
question before
you cut and paste it into your homework assignment.


-Original Message-
From: Dirk Enzmann [mailto:[EMAIL PROTECTED]
Sent: Sat 8/12/2006 7:01 AM
To: r-help@stat.math.ethz.ch
Cc: [EMAIL PROTECTED]
Subject: Re: [R] Geometrical Interpretation of Eigen value and Eigen vector
 
Arun,

have a look at:

http://149.170.199.144/multivar/eigen.htm

HTH,
Dirk

Arun Kumar Saha [EMAIL PROTECTED] wrote:

 It is not a R related problem rather than statistical/mathematical. However
 I am posting this query hoping that anyone can help me on this matter. My
 problem is to get the Geometrical Interpretation of Eigen value and Eigen
 vector of any square matrix. Can anyone give me a light on it?

__
R-help@stat.math.ethz.ch 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.