[R] Error message in function mars() in package mda
Martin Maechler
maechler at stat.math.ethz.ch
Wed Aug 11 11:18:13 CEST 2004
>>>>> "Jude" == Jude Ryan <juderyan at tcindex.com>
>>>>> on Tue, 10 Aug 2004 15:56:38 -0400 writes:
Jude> Hi, I am using function mars() in package mda to find
Jude> knots in a whole bunch of predictor variables. I hope
Jude> to be able to replicate all or some of the basis
Jude> functions that the MARS software from Salford Systems
Jude> creates. When I ran mars() on a small dataset, I was
Jude> able to get the knots. However, when I tried running
Jude> mars() on a larger dataset (145 predictor variables),
Jude> for a different project, I get the following error
Jude> message:
>> fit1 <- mars(disney2[,-146], disney2[,146])
Jude> Error in mars(disney2[, -146], disney2[, 146]) :
Jude> NA/NaN/Inf in foreign function call (arg 5)
Jude> In addition: Warning messages:
Jude> 1: NAs introduced by coercion
Jude> 2: NAs introduced by coercion
>>
Jude> Does arg 5 refer to the 5th column in my dataset?
no.
Jude> This seems to be a data problem, is this correct?
we cannot know with the little information you give.
Please read (and follow!!) the posting guide!
-> reproducible example !
-> contact the maintainer of the package in question!
The following reproducible example doesn't show the problem you
mentioned:
> library(mda)
> set.seed(101)
> X <- matrix(rnorm(200 * 150), 200, 150)
> fX <- mars(X[,-146], X[,146])
> str(fX)
List of 15
$ call : language mars(x = X[, -146], y = X[, 146])
$ all.terms : int [1:93] 1 2 3 4 5 6 7 8 9 10 ...
$ selected.terms: int [1:25] 1 2 3 4 5 10 12 13 14 16 ...
$ penalty : num 2
$ degree : num 1
$ nk : num 299
$ thresh : num 0.001
$ gcv : num 0.72
$ factor : num [1:99, 1:149] 0 0 0 0 0 0 0 0 0 0 ...
..- attr(*, "dimnames")=List of 2
.. ..$ : NULL
.. ..$ : NULL
$ cuts : num [1:99, 1:149] 0 0 0 0 0 0 0 0 0 0 ...
$ residuals : num [1:200, 1] 0.789 0.111 -0.212 1.017 -0.391 ...
$ fitted.values : num [1:200, 1] -0.216 -0.249 -0.116 -0.274 -0.353 ...
$ lenb : int 99
$ coefficients : num [1:25, 1] 0.696 0.491 1.013 -1.043 -0.409 ...
$ x : num [1:200, 1:25] 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, "class")= chr "mars"
>
BTW (as a note to the maintainer of "mda"):
print.mars() {and maybe summary.mars()} is severly lacking...
Jude> Are there any other functions in R that will give me
Jude> the knots for a set of predictor variables?
maybe, quite probably. This question is too vague ["the" knots?]
Regards,
Martin Maechler
More information about the R-help
mailing list