search for: con2tr

Displaying 6 results from an estimated 6 matches for "con2tr".

Did you mean: con2
2007 Aug 30
2
Need help putting histograms on the diagonal of a splom plot
...have a function that does the first two, but the histograms on the diagonal has been beyond my ability. Here is my function: require(lattice) require(MASS) my.plot = function(data) { splom( ~data , lower.panel=function(x,y, ...) { xy=kde2d(x,y) xy.tr=con2tr(xy) panel.contourplot( xy.tr$x , xy.tr$y , xy.tr$z , subscripts=seq(nrow(xy.tr)) , contour=TRUE , region=TRUE , l...
2002 Jan 18
1
New R on Mac user fails to run MASS
....2.2) is working, but when I try to run the examples from Venables & Ripley (p. 6): R : Copyright 2001, The R Development Core Team Version 1.4.0 (2001-12-19) ... > library(MASS) > x<-rnorm(1000) > y<-rnorm(1000) > truehist(c(x,y+3),nbins=25) % Plots nicely > dd<-con2tr(kde2d(x,y)) % Doesn't complain > contourplot(z ~ x + y, data=dd,aspect=1) Error: couldn't find function "contourplot" > wireframe(z ~ x + y, data=dd,drape=T) Error: couldn't find function "wireframe" > -- ==============================================...
2006 May 11
1
Conditional contour plots for estimated density functions using Lattice
...wise I could probably have used the panel function to do the needed conversion. Here is my current, not very elegant, solution: estcontplot=function(x, y, grp, ...) { cest=matrix( nrow=0, ncol=4 ) for( i in levels(grp) ) { cest.gr=kde2d( x[grp==i], y[grp==i] ) cest.gr.lat=con2tr(cest.gr) cest.gr.lat=cbind(cest.gr.lat, i) cest=rbind(cest, cest.gr.lat) } contourplot( z ~ x * y | i, data=cest,...) } And here is a simple example of how it works: library(lattice) n=100 x <- y <- grp <- numeric() for(p in 1:4) { xx=rnorm(n)+p/3 yy=p*xx+rnorm...
2008 May 30
1
Reducing space around lattice wireframe plots
...t it in the documentation. Here is example code for two panels showing the problem. library(MASS) library(lattice) n = 10^3 x1 = rnorm(n) y1 = 3 * x1 + 5 * rnorm(n) x2 = rnorm(n) y2 = 3 * rnorm(n) + 5 * rnorm(n) ran = c(range(c(x1, x2)), range(c(y1, y2))) xy1 = con2tr(kde2d(x1, y1, n = 30, lims = ran)) xy1$dist = "correlated" xy2 = con2tr(kde2d(x2, y2, n = 30, lims = ran)) xy2$dist = "uncorrelated" xy = rbind(xy1, xy2) wireframe(z ~ x * y | dist, xy, screen = list(z = 16, y = -5, x = -47)) -- Karl Ove Hufthammer
2006 Jun 24
1
Overlaying 2D kernel density plots on scatterplot matrix
Hi all We are pretty new to R here and trying to achieve something that we believe is possible but it?s not easy to work out how to do it. We are producing scatterplot matrices for e.g. 10 variables. What we would like to do is superimpose 2D kernel density estimators on top of each plot so that we end up with a scatterplot matrix of 2D kernel density (contour) plots. The kernel density plots
2008 Sep 18
0
Joint distributions
...in the plot I've added in this mail. You can use the added dataset "Rhelpdata.txt" to reproduce a similar plot: D0=read.table("Rhelpdata.txt",header=TRUE) library(lattice) library(MASS) x=D0$totaltp y=D0$totalhm0 p1=1/(365*4) Ps=c(p1,p1/10,p1/100) contourplot(z~x+y,data=con2tr(kde2d(x,y,n=50)),xlim=c(0,32),ylim=c(0,16),xlab="Peak period (sec)",ylab="Significant wave height (m)",region=TRUE,fill=TRUE,at=Ps,labels=c("1yr","10yr","100yr")) My problem is that I wish for the contour lines to extend to non-observed return val...