[R] error using polymars argument

Jim Lemon jim at bitwrit.com.au
Thu May 1 23:19:55 CEST 2014


On 05/01/2014 09:47 PM, varin sacha wrote:
> Hi Dear all,
> I got an error when I try to do a MARS regression with the "polymars" argument on the A matrix and the V vector here below.
> I don't understand the error, I have nrow=22 for the response variable and for the predictor matrix.
> So if somebody could tell me what is going wrong, it would be very nice.
>
> A=matrix(c(74.711,64.614,83.514,78.187,71.327,86.197,49.986,69.012,79.591,83.158,65.437,56.225,54.485,90.531,93.357,79.15,63.611,73.133,53.497,56.328,89.585,56.289,10.92,8.08,11.92,10.75,12.08,10.58,9.33,14.17,13.25,14.33,6.92,12.42,7.17,13.75,16.83,13.67,5.25,10,7.08,10.83,14.58,11.75,nrow=22,ncol=2))
>
> V=c(44986,18288,56147,44488,41018,40631,27301,39025,45688,47172,12300,21558,16103,48874,67245,36119,10398,42630,12879,34058,84443,30639)
>
> polymars(V,A)
> Erreur dans polymars(V, A) :
>    The number of rows (cases) of the response and predictor matricies should be the same
>
Hi varin,
You have a misplaced parenthesis in your definition of A. It should be:

A<-matrix(c(74.711,64.614,83.514,78.187,71.327,86.197,49.986,69.012,
  79.591,83.158,65.437,56.225,54.485,90.531,93.357,79.15,63.611,73.133,
  53.497,56.328,89.585,56.289,10.92,8.08,11.92,10.75,12.08,10.58,9.33,
  14.17,13.25,14.33,6.92,12.42,7.17,13.75,16.83,13.67,5.25,10,7.08,10.83,
  14.58,11.75),nrow=22,ncol=2)

Jim



More information about the R-help mailing list