Displaying 9 results from an estimated 9 matches for "zmat".
Did you mean:
mat
2006 Jun 27
3
how to rotate a triangle image(ZMAT) ?
Hello R users...
how to align this Zmat (triangle image) in X axis?
I would like that the triangle's base become in the X
axis and
the triangle's height become in the Y axis
Is there some trick for make this?
Thanks.
Cleber
######################## my test and try
f <- function(x,y){
z=1-x-y
z[ z < (-1e-15) ]...
2011 Jul 12
1
spatial logit help
Please I am new to R. I got the following code from a friend:
gmat <- cbind(gmat,p*(1-p)*wxb)
for (j in seq(1:ncol(gmat))) {
gmat[,j] <- fitted(lm(gmat[,j]~zmat))
}
It is for spatial logit.
After defining all the matrices in it such as P, wxb, gmat, and zmat,
I tried to run it in R and got the following error message:
Error in model.frame.default(formula = gmat[, j] ~ zmat, drop.unused.levels = TRUE) :
invalid type (list) for variable 'zmat'...
2011 Oct 13
2
how to plot two surfaces with lattice::wireframe
...-c(Re(f(z),Im(f(z))
wireframe(func~x*y,data=plotz,groups=groups)
But that seems like a clunky way to go, especially if I happen to have
started out with a nice matrix of the f(z) values.
So, is there some simpler way to write the formula in wireframe? I
envision, for a matrix of complex values zmat, pseudocode:
wireframe(c(Re(zmat),Im(zmat), groups=1:2)
-- and yes, I'm fully aware that without a connection between the
'groups' variable and zmat, this won't work as written.
All suggestions (including "read the help file for {some lattice func I
didn't know abou...
2005 Jan 13
1
how to use solve.QP
...<- c(1, mu.target)
cUp <- c(1, Inf)
bLo <- rep(0, n)
bUp <- rep(1, n)
#I convert [cLo <= A <= cUp] to Amat >= bvec and [bLo=0 <= w #<=1=bUp] to
Amat <- rbind(-1, 1, -mu, mu)
dim(bLo) <- c(n,1)
dim(bUp) <- c(n,1)
bvec <- rbind(-1, 1, mu.target, Inf, bLo, -bUp)
zMat <- matrix(rep(0,2*n*n),ncol=n, nrow=n*2)
zMat[,1] <- c(rep(1,n), rep(-1,n))
Amat <- t(rbind(Amat, zMat))
#So I set Dmat=Cov and set dvec=0
Dmat=Cov
dvec=rep(0, nrow(Amat))
#The first two rows of Amat should be equality constraints (so weights sum to 1)
meq <- 2
sol <- solve.Q...
2008 Jul 03
2
Plotting Prediction Surface with persp()
...;- c("x","y","o")
xor.nn <- nnet(o ~ x + y, data=xor.data, linout=FALSE, size=1)
# Create an (x.y) surface and predict over all points
d <- data.frame(expand.grid(seq(0,1,.1), seq(0,1,.1)))
names(d) <- c("x","y")
p <- predict(xor.nn, d)
zmat <- as.matrix(cbind(d,p))
Now my z matrix consists of x and y points, and the corresponding prediction
value for each (x,y) tuple. What would be the best way to plot these? I
tried persp(), but it didnt like the z matrix. Is there an alternative plot
function that I could use (I am presuming I n...
2007 Nov 23
1
complex conjugates roots from polyroot?
Hi, All:
Is there a simple way to detect complex conjugates in the roots
returned by 'polyroot'? The obvious comparison of each root with the
complex conjugate of the next sometimes produces roundoff error, and I
don't know how to bound its magnitude:
(tst <- polyroot(c(1, -.6, .4)))
tst[-1]-Conj(tst[-2])
[1] 3.108624e-15+2.22045e-16i
2008 Mar 18
1
How to reverse colors in filled.contour?
Hi,
I am plotting values of log(hazards ratio) as a function of two predictors,
using the plotting function filled.contour(). Here is a simple simulated
example of this:
x <- seq(0,1, length=20)
y <- seq(0,1, length=20)
z <- outer(x,y, function(x,y) x^2 + y^2 )
zmat <- matrix( rexp(n=400, rate = z+0.001), 20, 20)
filled.contour(x, y, log(zmat), xlab="X", ylab="Y", color=heat.colors,
main="log-Hazard ratios for different X & Y cutoffs")
Here lower hazard-ratios are reddish and higher values are lighter. I would
like...
2008 Aug 30
1
Unable to send color palette through plot.Design to method="image"
...it appears only with
the default color palette despite various efforts to supply a col
argument. I even took a crack at hacking the plot.Design function,
adding a col=col parameter to be passed in the function call to
image(), but failed to get the desired effect:
# else image(xseqn, y, zmat, xlab = xlab, ylab = laby , col = col)
library(Hmisc); library(Design)
lr.fit6 <- lrm(death ~
rcs(BL_CHOLEST.A,c(180,220,280))*rcs(BL_HDL.A,c(40,55,70))*Sex, data =
pref900)
# str(pref900[,c("BL_HDL.A","BL_CHOLEST.A","death")])
$'data.frame': 910659 ob...
2006 Jun 25
1
Puzzled with contour()
Folks,
The contour() function wants x and y to be in increasing order. I have
a situation where I have a grid in x and y, and associated z values,
which looks like this:
x y z
[1,] 0.00 20 1.000
[2,] 0.00 30 1.000
[3,] 0.00 40 1.000
[4,] 0.00 50 1.000
[5,] 0.00 60 1.000
[6,] 0.00 70 1.000
[7,] 0.00 80 0.000
[8,] 0.00 90