Displaying 2 results from an estimated 2 matches for "quadform".
Did you mean:
quad_form
2005 Oct 05
1
(no subject)
...solve(covXY)
#up<-max(meanx+4*varx^.5,meanx-4*varx^.5,meany+4*vary^.5,meany-4*vary^.5)
#x <- seq(-up,up,length=50)
#y <- x
x <- seq(meanx-3*varx^.5,meanx+3*varx^.5,length=50)
y <- seq(meany-3*vary^.5,meany+3*vary^.5,length=50)
f <- function(x,y,...)
{
detA<-det(A)
quadForm<-A[1,1]*(x-meanx)^2+2*A[1,2]*(x-meanx)*(y-meany)+A[2,2]*(y-meany)^2
K<-sqrt(detA)/(2*pi)
exp(-0.5*quadForm)*K
}
z <- outer(x, y, f)
par(mfrow=c(1,2))
persp(x, y, z,theta = 30, phi = 30,col="white",main="BI-VARIATE NORMAL
DISTRIBUTION")
contour(x,y,z,main=past...
2004 Oct 06
3
crossprod vs %*% timing
Hi
the manpage says that crossprod(x,y) is formally equivalent to, but
faster than, the call 't(x) %*% y'.
I have a vector 'a' and a matrix 'A', and need to evaluate 't(a) %*% A
%*% a' many many times, and performance is becoming crucial. With
f1 <- function(a,X){ ignore <- t(a) %*% X %*% a }
f2 <- function(a,X){ ignore <-