[R] get the value of a biplane

Jeff Newmiller jdnewmil at dcn.davis.ca.us
Mon May 29 08:35:55 CEST 2017


Looks like it is not exported from the package namespace... a packaging error. 
-- 
Sent from my phone. Please excuse my brevity.

On May 28, 2017 1:53:29 PM PDT, Rui Barradas <ruipbarradas at sapo.pt> wrote:
>Hello,
>
>Can anyone explain why this error?
>
> > library(splines)
> >
> > knots <- c(6, 12, 22, 30, 35)
> > x <- c(0.0, .25, 1.0, 2.0, 3.0)
>> SCurve <- bs(x = x, knots = knots, intercept = FALSE, Boundary.knots 
>= c(0,3.5))
> > class(SCurve)
>[1] "bs"     "basis"  "matrix"
> >
> > ?predict.bs
> > predict.bs(SCurve, xnew = 40:45)
>Error in predict.bs(SCurve, xnew = 40:45) :
>   could not find function "predict.bs"
>
>Note that splines:::predict.bs(SCurve, xnew = 40:45) works.
>
> > sessionInfo()
>R version 3.4.0 (2017-04-21)
>Platform: x86_64-w64-mingw32/x64 (64-bit)
>Running under: Windows 7 x64 (build 7601) Service Pack 1
>
>Matrix products: default
>
>locale:
>[1] LC_COLLATE=Portuguese_Portugal.1252 
>LC_CTYPE=Portuguese_Portugal.1252
>[3] LC_MONETARY=Portuguese_Portugal.1252 LC_NUMERIC=C 
>
>[5] LC_TIME=Portuguese_Portugal.1252
>
>attached base packages:
>[1] splines   stats     graphics  grDevices utils     datasets  methods
>[8] base
>
>loaded via a namespace (and not attached):
>[1] compiler_3.4.0 tools_3.4.0
>
>
>Rui Barradas
>
>
>Em 28-05-2017 17:37, Rui Barradas escreveu:
>> Hello,
>>
>> Since function splines::bs returns an object of class bs in order to
>> read the help page for function predict you need
>>
>> ?predict.bs
>>
>> The syntax would be
>>
>> ## S3 method for class 'bs'
>> predict(object, newx, ...)
>>
>> Please read that help page and maybe you'll get the answer you need.
>>
>> Hope this helps,
>>
>> Rui Barradas
>>
>> Em 28-05-2017 15:51, Glenn Schultz escreveu:
>>> If is specify a spline basis as follows
>>>
>>> knots <- c(6, 12, 22, 30, 35)
>>> x <- c(0.0, .25, 1.0, 2.0, 3.0)
>>> SCurve <- bs(x = x, knots = knots, intercept = FALSE, Boundary.knots
>=
>>> c(0,3.5))
>>>
>>> I would like to now get the spline value for new values of x. 
>However,
>>> when I use predict the new basis is returned and I would like to get
>the
>>> value.  Nothing has worked so far and ?predict plus examples only
>show
>>> prediction from linear models.  Is there a way to extract the value
>from
>>> a defined spline?
>>>
>>> Best Regards,
>>> Glenn
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> 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.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> 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.
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.



More information about the R-help mailing list