[R] Is there a function for scatter3d with Categorical responses?

Steve_Friedman at nps.gov Steve_Friedman at nps.gov
Thu Feb 16 15:18:21 CET 2012


John,

I would like ellipsoids to represent the distributions relative to each of
the vegetation types.

I tried your approach thinking that it would work as well, but I'm getting
an error

scatter3d(MADep2004 ~ Dhydro2004 + MedWet2004 | VegtypeID, ellipsoid=TRUE.
data= CSSS)

Error in sprintf ("Number of groups (%d) exceeds number of colors (%d)"):
too few arguments


I've explored the effects package as well, but I have to study its
application more to fully appreciate using it with multinomial models.

Steve

Steve Friedman Ph. D.
Ecologist  / Spatial Statistical Analyst
Everglades and Dry Tortugas National Park
950 N Krome Ave (3rd Floor)
Homestead, Florida 33034

Steve_Friedman at nps.gov
Office (305) 224 - 4282
Fax     (305) 224 - 4147


                                                                           
             "John Fox"                                                    
             <jfox at mcmaster.ca                                             
             >                                                          To 
                                       <Steve_Friedman at nps.gov>            
             02/16/2012 09:02                                           cc 
             AM                        <r-help at r-project.org>              
                                                                   Subject 
                                       RE: [R] Is there a function for     
                                       scatter3d with Categorical          
                                       responses?                          
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Dear Steve,

It's not obvious to me what you want to do. If you want ellipsoids for
MeanAnnualDepth, Hydroperiod, and MedianWet, which sound as if they are
numeric variables, separately for each VegtypeID, which is presumably a
factor with several sets of measurements for each value, then
MeanAnnualDepth ~ Hydroperiod + MedianWet | VegtypeID, should work (and you
can suppress the regression surface). BTW, after specifying data=CSSS, you
don't have to index variables explicitly in the data frame, e.g., as
CSSS$VegtypeID.

I hope this helps, but I suspect that I don't really understand what you
want to do.

Best,
 John

--------------------------------
John Fox
Senator William McMaster
  Professor of Social Statistics
Department of Sociology
McMaster University
Hamilton, Ontario, Canada
http://socserv.mcmaster.ca/jfox




> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Steve_Friedman at nps.gov
> Sent: February-16-12 8:38 AM
> To: r-help at r-project.org
> Subject: [R] Is there a function for scatter3d with Categorical
> responses?
>
>
>
> Hello,
>
> I'm working with a series (30+)  of hydrologic metrics and 10
> vegetation communities and I need to determine which of the metrics
> provide the best separability for each of the vegetation communities.
> The hydrologic metrics are highly correlated, therefore the need to
> reduce the number of them considered is critically important.
>
> I've been looking at the scatter3d function in the car package as a
> tool that offers exceptionally useful visualizations.
>
> As an example, the options to run this function as follows is very
> much what I'm after but with a categorical response instead of a
> continuous one
>
> library(car)
> library(rgl)
> scatter3d(prestige ~ income + education | type , surface=FALSE,
> ellipsoid=TRUE, revolutions=3, data=Duncan)
>
> Using my data I'd like to use the function as follows:
>
> scatter3d(CSSS$VegtypeID ~ CSSS$MeanAnnualDepth + CSSS$Hydroperiod +
> CSSS$MedianWet, ellipsoid=TRUE, revolutions=3, data=CSSS)
>
> or:
>
> scatter3d(CSSS$DA7Depth ~ CSSS$MeanAnnualDepth + CSSS$Hydroperiod +
> CSSS$MedianWet | type=CSSS$VegtypeID,  ellipsoid=TRUE, revolutions=3,
> data=CSSS)
>
>
> If you know of a different function / package combination that can
> handle this approach I'd really like to learn about it. The ellipsoid
> is exceptionally valuable and I'm really interested in a function that
> offers that option.
>
> Thanks
> Steve
>
> Steve Friedman Ph. D.
> Ecologist  / Spatial Statistical Analyst Everglades and Dry Tortugas
> National Park
> 950 N Krome Ave (3rd Floor)
> Homestead, Florida 33034
>
> Steve_Friedman at nps.gov
> Office (305) 224 - 4282
> Fax     (305) 224 - 4147
>
> ______________________________________________
> R-help at 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.



More information about the R-help mailing list