In my experience (and per the help pages now that I look) the predict
functions need named arguments that match up with the column names in
the model and generally this needs to be supplied as a dataframe or a
list.
(note: at least on my machine the rock dataframe does *not* have the
names you offered)
predict(rock.ppr, list(area=10, peri= 3, shape=2)) # or...
predict(rock.ppr, data.frame(area=10, peri= 3, shape=2))
> predict(rock.ppr, list(area=10, peri= 3, shape=2))
1
7.118094
--
David Winsemius
On Feb 27, 2009, at 10:09 AM, Olivier MARTIN wrote:
> Hi all,
>
> I have some difficulties with the function ppr for projection
> pursuit regression.
> I obtained the results for a projection pursuit regression and now I
> would like to
> compute some predictions for new data.
>
> I tried the function predict in the following way predict(res.ppr,
> newdata) but it seems
> that it is not right. The data rock is given for illustration of the
> function ppr.
>
> attach(rock)
>
> rock.ppr <- ppr(log(perm) ~ area1 + peri1 + shape, data = rock,
> nterms = 2, max.terms = 5)
>
>
> So suppose I want to make a prediction for the point
> area1=10,peri1=3 and shape=2. I tried
> the command predict(rock.ppr, c(10,3,2)) but it returns
> an error message.
> So, could you indicate me the right way for this prediction?
>
> Thanks for your help.
> Olivier.
>
>
> --
>
> -------------------------------------------------------------
> Martin Olivier
> INRA - Unit? Biostatistique & Processus Spatiaux
> Domaine St Paul, Site Agroparc
> 84914 Avignon Cedex 9, France
> Tel : 04 32 72 21 57
> Fax : 04 32 72 21 82
>
> ______________________________________________
> 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.