src/ratfor/robcovf.r

## Usage: ratfor -o ../robcovf.f robcovf.r
## Computes sum of (within cluster sum of U)(within cluster sum of U)'
##
SUBROUTINE robcovf(n, p, nc, start, len, u, s, v, w)
IMPLICIT DOUBLE PRECISION (a-h,o-z)
INTEGER p, start(nc), len(nc)
DOUBLE PRECISION u(n,p), s(p), v(p,p), w(p,p)

do i=1,p		{
   do j=1,p		{
   w(i,j)=0d0		}}

do k=1,nc					{
   do i=1,p		{
     s(i)=0d0
     do j=1,p		{
     v(i,j)=0d0		}}
   do i=start(k),start(k)+len(k)-1	{
     do j=1,p		{
       s(j)=s(j)+u(i,j)	}
					}
   do i=1,p		{
     do j=1,p		{
     v(i,j)=v(i,j)+s(i)*s(j)
			}}

   do i=1,p		{
     do j=1,p		{
       w(i,j)=w(i,j)+v(i,j)
			}}
						}

return
end

Try the rms package in your browser

Any scripts or data that you put into this service are public.

rms documentation built on Sept. 12, 2023, 9:07 a.m.