Re: [R] how to add 3d-points to bplot {rms} figure?

2012-04-13 Thread David Winsemius


On Apr 12, 2012, at 6:09 PM, phi771 wrote:


h! thank you a lot for your effort and help.
i preferred a 3d view of the surface in order to see how well it  
fits the
real data (from the file). i will play around with the functions you  
have
mentioned and post my results or further problems. this will  
probably take a

few days :(

can anybody answer if i can extract the mesh in x,y,z coordinates  
from the

bplot?


With the example you offered (but failed to include as context):

You need to learn to use str()

str(bpl)
# output too long
 str(bpl$panel.args.common] )
# output still too long

 str(bpl$panel.args.common[c(x,y,z)] )
List of 3
 $ x: num [1:4] -2.44 -2.44 -2.43 -2.42 -2.41 ...
 $ y: num [1:4] -0.196 -0.196 -0.196 -0.196 -0.196 ...
 $ z: num [1:4] 107 106 106 105 104 ...






--

David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to add 3d-points to bplot {rms} figure?

2012-04-12 Thread phi771
h! thank you a lot for your effort and help. 
i preferred a 3d view of the surface in order to see how well it fits the
real data (from the file). i will play around with the functions you have
mentioned and post my results or further problems. this will probably take a
few days :(

can anybody answer if i can extract the mesh in x,y,z coordinates from the
bplot?
thank you again.



--
View this message in context: 
http://r.789695.n4.nabble.com/how-to-add-3d-points-to-bplot-rms-figure-tp4544050p4553227.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] how to add 3d-points to bplot {rms} figure?

2012-04-09 Thread phi771
Hello!
I have created a bplot-figure using this code:

*file - 2dcali_red.ttt
ux-as.matrix(read.table(file, dec = ,))

mode(ux)-'numeric'

vel-ux[,1]
ang-ux[,2] 
x-ux[,3]
y-ux[,4]

dat- data.frame(ang=ang, x=x,y=y) 

require(rms)

ddist2 - datadist(dat)
options(datadist=ddist2)

fitn - lrm(ang ~ rcs(x,4) + rcs(y,4), data=dat)
predi - Predict(fitn, x, y)

bplot(predi,lfun=wireframe, screen = list(z = -40, x = -80), drape=TRUE)*

The file 2dcali_red.ttt  consists of 4 columns can be found here :
http://www.color-space.de/upload/dl/2dcali_red.ttt link 

The code gives me the bplot-figure, which looks like this:
http://r.789695.n4.nabble.com/file/n4544050/Screen_shot_2012-04-10_at_12.04.24_AM.png
 

Now I want to add some 3d data (x,y,z) to this plot (like scatterplot3d),
but i don't know how. I also don't know how to extract the x,y,z mesh as
coordinates from the bplot. Some help would be very appreciated. Thank you!

--
View this message in context: 
http://r.789695.n4.nabble.com/how-to-add-3d-points-to-bplot-rms-figure-tp4544050p4544050.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to add 3d-points to bplot {rms} figure?

2012-04-09 Thread David Winsemius


On Apr 9, 2012, at 6:24 PM, phi771 wrote:


Hello!
I have created a bplot-figure using this code:

*file - 2dcali_red.ttt
ux-as.matrix(read.table(file, dec = ,))

mode(ux)-'numeric'

vel-ux[,1]
ang-ux[,2]
x-ux[,3]
y-ux[,4]

dat- data.frame(ang=ang, x=x,y=y)

require(rms)

ddist2 - datadist(dat)
options(datadist=ddist2)

fitn - lrm(ang ~ rcs(x,4) + rcs(y,4), data=dat)
predi - Predict(fitn, x, y)

bplot(predi,lfun=wireframe, screen = list(z = -40, x = -80),  
drape=TRUE)*


The file 2dcali_red.ttt  consists of 4 columns can be found here :
http://www.color-space.de/upload/dl/2dcali_red.ttt link

The code gives me the bplot-figure, which looks like this:
http://r.789695.n4.nabble.com/file/n4544050/Screen_shot_2012-04-10_at_12.04.24_AM.png

Now I want to add some 3d data (x,y,z) to this plot (like  
scatterplot3d),
but i don't know how. I also don't know how to extract the x,y,z  
mesh as
coordinates from the bplot. Some help would be very appreciated.  
Thank you!


That is most probably a lattice::wireframe object. You could use  
'trellis.focus' or the 'layer' functions in pkg::latticeExtra to  
attempt panel.3dbars() additions. I haven't actually done this, but I  
have added panel function results to the lattice::contourplots that  
are created byrms/Hmisc.


The 3d aspect adds a significant level of extra work: 
http://tolstoy.newcastle.edu.au/R/e2/help/06/10/3274.html

Maybe a contourplot would suffice?

--
David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to add 3d-points to bplot {rms} figure?

2012-04-09 Thread David Winsemius


On Apr 9, 2012, at 10:39 PM, David Winsemius wrote:



On Apr 9, 2012, at 6:24 PM, phi771 wrote:


Hello!
I have created a bplot-figure using this code:

*file - 2dcali_red.ttt
ux-as.matrix(read.table(file, dec = ,))

mode(ux)-'numeric'

vel-ux[,1]
ang-ux[,2]
x-ux[,3]
y-ux[,4]

dat- data.frame(ang=ang, x=x,y=y)

require(rms)

ddist2 - datadist(dat)
options(datadist=ddist2)

fitn - lrm(ang ~ rcs(x,4) + rcs(y,4), data=dat)
predi - Predict(fitn, x, y)

bplot(predi,lfun=wireframe, screen = list(z = -40, x = -80),  
drape=TRUE)*


The file 2dcali_red.ttt  consists of 4 columns can be found here :
http://www.color-space.de/upload/dl/2dcali_red.ttt link

The code gives me the bplot-figure, which looks like this:
http://r.789695.n4.nabble.com/file/n4544050/Screen_shot_2012-04-10_at_12.04.24_AM.png

Now I want to add some 3d data (x,y,z) to this plot (like  
scatterplot3d),
but i don't know how. I also don't know how to extract the x,y,z  
mesh as
coordinates from the bplot. Some help would be very appreciated.  
Thank you!


That is most probably a lattice::wireframe object. You could use  
'trellis.focus' or the 'layer' functions in pkg::latticeExtra to  
attempt panel.3dbars() additions. I haven't actually done this, but  
I have added panel function results to the lattice::contourplots  
that are created byrms/Hmisc.


The 3d aspect adds a significant level of extra work: 
http://tolstoy.newcastle.edu.au/R/e2/help/06/10/3274.html


There is also a panel.3d.identify and panel.identify.cloud that might  
be needed:


https://r-forge.r-project.org/scm/viewvc.php/pkg/R/interaction.R?view=markuprevision=675root=lattice

My efforts at adding bars to that plot have failed so far. This does  
not do anything useful:


 trellis.focus(panel, 1, 1)
 panel.3dbars(x=-1.5, y=-.1, z=0,distance=20,  col=red,
 xlim=c(-2.4,-1), ylim=c(-0.15, 0.15), zlim=c(-50,100),
  xlim.scaled=c(-0.5,0.5), ylim.scaled=c(-0.5,0.5),
  zlim.scaled=c(-0.5,0.5), zero.scaled=25)
 trellis.unfocus()



Maybe a contourplot would suffice?




David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] how to add 3d-points to bplot {rms} figure?

2012-04-09 Thread Bert Gunter
Below.

-- Bert

On Mon, Apr 9, 2012 at 7:39 PM, David Winsemius dwinsem...@comcast.net wrote:

 On Apr 9, 2012, at 6:24 PM, phi771 wrote:

 Hello!
 I have created a bplot-figure using this code:

 *file - 2dcali_red.ttt
 ux-as.matrix(read.table(file, dec = ,))

 mode(ux)-'numeric'

 vel-ux[,1]
 ang-ux[,2]
 x-ux[,3]
 y-ux[,4]

 dat- data.frame(ang=ang, x=x,y=y)

 require(rms)

 ddist2 - datadist(dat)
 options(datadist=ddist2)

 fitn - lrm(ang ~ rcs(x,4) + rcs(y,4), data=dat)
 predi - Predict(fitn, x, y)

 bplot(predi,lfun=wireframe, screen = list(z = -40, x = -80), drape=TRUE)*

 The file 2dcali_red.ttt  consists of 4 columns can be found here :
 http://www.color-space.de/upload/dl/2dcali_red.ttt link

 The code gives me the bplot-figure, which looks like this:

 http://r.789695.n4.nabble.com/file/n4544050/Screen_shot_2012-04-10_at_12.04.24_AM.png

 Now I want to add some 3d data (x,y,z) to this plot (like scatterplot3d),
 but i don't know how. I also don't know how to extract the x,y,z mesh as
 coordinates from the bplot. Some help would be very appreciated. Thank
 you!


 That is most probably a lattice::wireframe object. You could use
 'trellis.focus' or the 'layer' functions in pkg::latticeExtra to attempt
 panel.3dbars() additions. I haven't actually done this, but I have added
 panel function results to the lattice::contourplots that are created
 byrms/Hmisc.

 The 3d aspect adds a significant level of extra work:
And is generally a bad idea. Perspective plots of all types are much
over-hyped. They are pretty, but the very act of creating artificial
perspective for non-realistic shapes can distort perception and lead
to misinterpretation of data. Parts of the scene hide other parts; it
is difficult to quantitatively judge depths of valleys and heights of
hills; etc. And, as David notes, it is very difficult to get right.

 http://tolstoy.newcastle.edu.au/R/e2/help/06/10/3274.html

 Maybe a contourplot would suffice?
-- and is generally a much better, albeit less sexy, idea.


 --
 David Winsemius, MD
 West Hartford, CT

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.