[R] Coding matrix equation

matthew.r.robinson at sheffield.ac.uk
Mon, 11 Apr 2011 07:43:03 -0000

Hi all,

I have two matrices:

G<-matrix(c(2.0, 0.5, 0.5, 0.5, 2.0, 0.5, 0.5, 0.5,2.0),3,3)
P<-matrix(c(1.0, 0.5, 0.5, 0.5, 1.0, 0.5, 0.5, 0.5,1.0),3,3)

and I want to run this equation to get a new matrix F:

F = [P+2G]^-1/2 P [P+2G]^-1/2

Could someone please tell me how to code this in R?

Many thanks in advance for your time.

Best wishes,
Matt

	[[alternative HTML version deleted]]