Dear helpers, I am trying to use the mda package downloaded from the R website, but the data set has missing values so I got an error message. Should I manually handle these missing values? I was trying to read the documents to specify any option related to missing values, but I did not find it. Please forgive me if I ignore something obvious. Thanks, Zhu Wang Statistical Science Department Southern Methodist University Dallas, TX 75275-0332 Phone: (214)768-2453 Fax: (214)768-4035 Email: zhuw at mail.smu.edu
zhu wang wrote:> > Dear helpers, > > I am trying to use the mda package downloaded from the R website, but > the data set has missing values so I got an error message. Should I > manually handle these missing values? I was trying to read the documents > to specify any option related to missing values, but I did not find it. > Please forgive me if I ignore something obvious.If it is not documented (hence probably not available) and you don't know how to tell the functions to handle missing values, try to do it "yourself". ?NA suggests: "See Also: [...] 'na.action', 'na.omit', 'na.fail' on how methods can be tuned to deal with missing values." Uwe Ligges> Thanks, > > Zhu Wang > > Statistical Science Department > Southern Methodist University > Dallas, TX 75275-0332 > Phone: (214)768-2453 > Fax: (214)768-4035 > Email: zhuw at mail.smu.edu > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
I basically wanted to use MARS to reproduce results using the dataset "Marketing" in the following book http://www-stat-class.stanford.edu/~tibs/ElemStatLearn/ The authors actually provided S-Plus functions for mars, bruto ,etc. I used all default options of mars in R but there was an error due to NAs and I could not find any option to handle missing values. Zhu Wang -----Original Message----- From: Prof Brian Ripley [mailto:ripley at stats.ox.ac.uk] Sent: Fri 4/9/2004 12:53 PM To: Wang, Zhu Cc: Uwe Ligges; r-help at stat.math.ethz.ch; Kurt.Hornik at R-project.org Subject: Re: [R] missing values for mda package Package mda covers many things, including bruto, mars, polyreg and mda itself. Which `the original algorithm' for which option did you have in mind? More concretely, what where you trying to do with the package? Given that the package is the original authors' own code, it seems unlikely that they `killed one of the advantages' of their methodology, so elucidation is sorely needed. On 9 Apr 2004, zhu wang wrote:> Thanks. I was able to use na.omit to remove NAs. But it seems to me this > kills one of the advantages of the original algorithm for handling > missing values. > > On Tue, 2004-04-06 at 11:54, Uwe Ligges wrote: > > zhu wang wrote: > > > > > > Dear helpers, > > > > > > I am trying to use the mda package downloaded from the R website, but > > > the data set has missing values so I got an error message. Should I > > > manually handle these missing values? I was trying to read the documents > > > to specify any option related to missing values, but I did not find it. > > > Please forgive me if I ignore something obvious. > > > > If it is not documented (hence probably not available) and you don't > > know how to tell the functions to handle missing values, try to do it > > "yourself". ?NA suggests: > > "See Also: [...] 'na.action', 'na.omit', 'na.fail' on how methods can be > > tuned to deal with missing values." > > > > Uwe Ligges > > > > > > > > > Thanks, > > > > > > Zhu Wang > > > > > > Statistical Science Department > > > Southern Methodist University > > > Dallas, TX 75275-0332 > > > Phone: (214)768-2453 > > > Fax: (214)768-4035 > > > Email: zhuw at mail.smu.edu > > > > > > ______________________________________________ > > > R-help at stat.math.ethz.ch mailing list > > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html >-- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On Fri, 9 Apr 2004, Wang, Zhu wrote:> I basically wanted to use MARS to reproduce results using the dataset > "Marketing" in the following book > > http://www-stat-class.stanford.edu/~tibs/ElemStatLearn/ > > The authors actually provided S-Plus functions for mars, bruto ,etc. I > used all default options of mars in R but there was an error due to NAs > and I could not find any option to handle missing values.Friedman originated MARS and has code for it. The code in mda by Hastie/Tibshirani is different, and the code on that website is a direct ancestor of the mda package for R. I see no option in the code for mars there to handle missing values, so you would do better to ask the authors how they did it (if you really believe they have such an option). And PLEASE read the posting guide and try to learn to ask precise questions with enough background information! -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
The mda package has no facilities for missing data. Users are expected to supply "clean" data; i.e. any missing value treatment should take place before using any of the routines in the package. In particular, our version of the mars function takes inputs x and y, which are assumed to have no missing values. The "spam" data were used to demonstrate mars in "Elements of Statistical Learning" The spam data has no missing values, and can be obtained from http://www-stat.stanford.edu/~tibs/ElemStatLearn/ Trevor Hastie -------------------------------------------------------------------- Trevor Hastie hastie@stanford.edu Professor, Department of Statistics, Stanford University Phone: (650) 725-2231 (Statistics) Fax: (650) 725-8977 (650) 498-5233 (Biostatistics) Fax: (650) 725-6951 URL: http://www-stat.stanford.edu/~hastie address: room 104, Department of Statistics, Sequoia Hall 390 Serra Mall, Stanford University, CA 94305-4065 -------------------------------------------------------------------- [[alternative HTML version deleted]]