Steve_Friedman at nps.gov
2012-Feb-16 13:38 UTC
[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
John Fox
2012-Feb-16 14:02 UTC
[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.