[R] Splines

2016-09-04 Thread Filippo Monari
Hi,
I would like to use the C spline functions if R for a FORTRAN subroutine. What 
header file should I refer to?

Regards
Filippo Monari
__
R-help@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] Splines with more restrictions

2015-11-04 Thread BXC (Bendix Carstensen)
I would like to generate a natural spline where the slope beyond the last knot 
(the right outer knot) is constrained to be 0.
Is that available in some package around?
_

Bendix Carstensen
Senior Statistician
Steno Diabetes Center
Clinical Epidemiology
Niels Steensens Vej 2-4
DK-2820 Gentofte
Denmark
phone: +45 30 75 87 38
b...@steno.dk   http://BendixCarstensen.com

__
R-help@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.


Re: [R] splines package

2012-09-11 Thread R. Michael Weylandt
You likely need to load the package before you can use it:

library(splines)
? bs

works for me.

Cheers,
M

On Tue, Sep 11, 2012 at 11:32 PM, Luis Felipe Parra
 wrote:
> Hello Michael when I search for documentation it always appears as a
> separate package, if I try
>
>  ?bs
> No documentation for ‘bs’ in specified packages and libraries:
> you could try ‘??bs’
>
> ??bs
> I find this function is on the splines package.
>
> All this I am doing it on R 2.15.0 for Windows. any idea?
>
>
>
> On Tue, Sep 11, 2012 at 5:29 PM, R. Michael Weylandt
>  wrote:
>>
>> It should be included in your binary download of R. Is it not?
>>
>> Michael
>>
>> On Tue, Sep 11, 2012 at 11:18 PM, Luis Felipe Parra
>>  wrote:
>> > Hello all,
>> >
>> > I have been working with b-splines and noted that the splines package is
>> > not available in CRAN. Does any body know what happened with it?
>> > Or, is there any package that replaces it?
>> >
>> > Thank you
>> >
>> > Felipe Parra
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > __
>> > R-help@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.
>
>
>
>
> --
>
> Este mensaje de correo electrónico es enviado por Quantil S.A.S y puede
> contener información confidencial o privilegiada.
>
> This e-mail is sent by Quantil S.A.S and may contain confidential or
> privileged information
>
>

__
R-help@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.


Re: [R] splines package

2012-09-11 Thread R. Michael Weylandt
It should be included in your binary download of R. Is it not?

Michael

On Tue, Sep 11, 2012 at 11:18 PM, Luis Felipe Parra
 wrote:
> Hello all,
>
> I have been working with b-splines and noted that the splines package is
> not available in CRAN. Does any body know what happened with it?
> Or, is there any package that replaces it?
>
> Thank you
>
> Felipe Parra
>
> [[alternative HTML version deleted]]
>
> __
> R-help@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.

__
R-help@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.


[R] splines package

2012-09-11 Thread Luis Felipe Parra
Hello all,

I have been working with b-splines and noted that the splines package is
not available in CRAN. Does any body know what happened with it?
Or, is there any package that replaces it?

Thank you

Felipe Parra

[[alternative HTML version deleted]]

__
R-help@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.


[R] splines and ns equation

2012-05-31 Thread Ranae
Hi,

I am looking at the change in N concentration in plant roots over 4 time
points and I have fit a spline to the data using ns and lme:

fit10 <- lme( N~ns(day, 3), data = rcn10G)

I may want to adjust the model a little bit, but for now, let's assume it's
good.  I get output for the fixed effects:

Fixed: N ~ ns(day, 3) 
(Intercept) ns(day, 3)1 ns(day, 3)2 ns(day, 3)3 
 1.15676524  0.14509171  0.04459627  0.09334428 
 
and coefficients for each experimental unit in my experiment:

   (Intercept) ns(day, 3)1 ns(day, 3)2 ns(day, 3)3
241.050360 -0.42666159 -0.56290877 -0.10714407
131.104464 -0.30825350 -0.53311653 -0.05558150
311.147878 -0.14548512 -0.78673906 -0.07231781
461.177781 -0.22278380 -0.80278177 -0.02321460
151.144215 -0.04484519 -0.06084798  0.07633663
321.213007  0.00741061  0.03896933  0.15325849
231.274615  0.16477514  0.00872224  0.23128320
411.215626  0.57050767  0.11415467  0.10608867
431.134203  0.48070741  0.72112899  0.18108193
121.091422  0.39563632  1.01521528  0.22597459
211.100631  0.44589314  0.98526322  0.23535739
351.226980  0.82419937  0.39809568  0.16900841

NOW, I want to write a spline function where I can incorporate these
coefficients to get the predicted N concentration value for each day. 
However, I am having trouble finding the right spline equation, since there
are many forms on the internets.  

I know it won't be a simple one, but can some one direct me to the equation
that would be best to use for ns?

Thanks a lot,

Ranae



--
View this message in context: 
http://r.789695.n4.nabble.com/splines-and-ns-equation-tp4631986.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] splines package (problem finding it)

2010-09-14 Thread stephen sefick
Sorry for the trouble.  I thought it was an add-on.
kindest regards,

Stephen

2010/9/14 Uwe Ligges :
>
>
> On 14.09.2010 13:25, stephen sefick wrote:
>>
>> I can not install the splines package.  Has it been removed/moved from/on
>> CRAN?
>> kindest regards,
>
>
> It should come with R since it is a base package.
>
> Uwe Ligges
>
>
>



-- 
Stephen Sefick

| Auburn University                                   |
| Department of Biological Sciences           |
| 331 Funchess Hall                                  |
| Auburn, Alabama                                   |
| 36849                                                    |
|___|
| sas0...@auburn.edu                             |
| http://www.auburn.edu/~sas0025             |
|___|

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

                                -K. Mullis

"A big computer, a complex algorithm and a long time does not equal science."

                              -Robert Gentleman
__
R-help@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.


[R] splines package (problem finding it)

2010-09-14 Thread stephen sefick
I can not install the splines package.  Has it been removed/moved from/on CRAN?
kindest regards,

-- 
Stephen Sefick

| Auburn University                                   |
| Department of Biological Sciences           |
| 331 Funchess Hall                                  |
| Auburn, Alabama                                   |
| 36849                                                    |
|___|
| sas0...@auburn.edu                             |
| http://www.auburn.edu/~sas0025             |
|___|

Let's not spend our time and resources thinking about things that are
so little or so large that all they really do for us is puff us up and
make us feel like gods.  We are mammals, and have not exhausted the
annoying little problems of being mammals.

                                -K. Mullis

"A big computer, a complex algorithm and a long time does not equal science."

                              -Robert Gentleman
__
R-help@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.


Re: [R] splines package (problem finding it)

2010-09-14 Thread Uwe Ligges



On 14.09.2010 13:25, stephen sefick wrote:

I can not install the splines package.  Has it been removed/moved from/on CRAN?
kindest regards,



It should come with R since it is a base package.

Uwe Ligges

__
R-help@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.


Re: [R] Splines under tension

2010-05-17 Thread David Winsemius


On May 16, 2010, at 1:12 PM, sam.e wrote:



Thank you for the helpful direction to the smoothing splines  
function, it was
very helpful and is exactly what i am trying to do. My data however  
is 3-D,
i.e. i have x and y values which are coordinates for different field  
sites

and z values which are really what I am interested in analysing with
interpolation. This has posed a problem with many of the spline  
functions in
R. Even if i input my coordinate data as a matrix as my 'x' value  
and my

site data as my 'y' values i get the following error:


You could look at the code in the Design or rms packages for handling  
crossed regression splines. I believe that the ols function within  
those packages will handle the identity link models, although my  
experience is only with the lrm and cph models. In those frameworks  
with logistic and log links I am able to estimate outcomes with two- 
dimensional splines. Harrell also provides a "%ia%" operator that  
provides for spline models with a reduced number of degrees of  
freedom. The best place to find a coherent description of the math is  
his book "Regression Modeling Strategies".


--
David




Error in xy.coords(x, y) : 'x' and 'y' lengths differ

I have made sure that there are the same amount of values and that  
they are
all of the same type, i.e. numeric but with little luck and i am a  
bit lost

as to what to try next. Does anyone have any suggestions?

Thanks,

Sam
--
View this message in context: 
http://r.789695.n4.nabble.com/Splines-under-tension-tp2173887p2218693.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


__
R-help@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.


Re: [R] Splines under tension

2010-05-16 Thread William Dunlap
> -Original Message-
> From: r-help-boun...@r-project.org 
> [mailto:r-help-boun...@r-project.org] On Behalf Of sam.e
> Sent: Sunday, May 16, 2010 10:13 AM
> To: r-help@r-project.org
> Subject: Re: [R] Splines under tension
> 
> 
> Thank you for the helpful direction to the smoothing splines 
> function, it was
> very helpful and is exactly what i am trying to do. My data 
> however is 3-D,
> i.e. i have x and y values which are coordinates for 
> different field sites
> and z values which are really what I am interested in analysing with
> interpolation.

Look into the 'Tps' (thin plate splines) package.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com  

> This has posed a problem with many of the 
> spline functions in
> R. Even if i input my coordinate data as a matrix as my 'x' 
> value and my
> site data as my 'y' values i get the following error:
> 
> Error in xy.coords(x, y) : 'x' and 'y' lengths differ
> 
> I have made sure that there are the same amount of values and 
> that they are
> all of the same type, i.e. numeric but with little luck and i 
> am a bit lost
> as to what to try next. Does anyone have any suggestions?
> 
> Thanks, 
> 
> Sam
> -- 
> View this message in context: 
> http://r.789695.n4.nabble.com/Splines-under-tension-tp2173887p
2218693.html
> Sent from the R help mailing list archive at Nabble.com.
> 
> __
> R-help@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.
> 

__
R-help@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.


Re: [R] Splines under tension

2010-05-16 Thread sam.e

Thank you for the helpful direction to the smoothing splines function, it was
very helpful and is exactly what i am trying to do. My data however is 3-D,
i.e. i have x and y values which are coordinates for different field sites
and z values which are really what I am interested in analysing with
interpolation. This has posed a problem with many of the spline functions in
R. Even if i input my coordinate data as a matrix as my 'x' value and my
site data as my 'y' values i get the following error:

Error in xy.coords(x, y) : 'x' and 'y' lengths differ

I have made sure that there are the same amount of values and that they are
all of the same type, i.e. numeric but with little luck and i am a bit lost
as to what to try next. Does anyone have any suggestions?

Thanks, 

Sam
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Splines-under-tension-tp2173887p2218693.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


Re: [R] Splines under tension

2010-05-12 Thread David Winsemius


On May 12, 2010, at 2:41 PM, David Winsemius wrote:



On May 12, 2010, at 2:37 PM, Greg Snow wrote:


I think this last line is a fortune candidate:

It's not just that different disciplines rediscover the same ideas,  
they also relabel them.




With apologies to Aretha: I second that emotion.


Further Apologies:
An r-helper with a better memory than mine points out that I should  
have cited Smokey rather than Aretha.


--

David.


--
David.



--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Terry Therneau
Sent: Wednesday, May 12, 2010 6:49 AM
To: sam.e
Cc: r-help@r-project.org
Subject: Re: [R] Splines under tension

---begin included message ---

Does anyone know if R has a function for splines under tension. I  
know

there are numerous packages for spline interpolation within R i just
can't find one that lets you determine the tension factor.

--

In the statistics literature these are called "smoothing  
splines".  For

instance the s(x) construct in gam or pspline(x) in a coxph formula.
There are multiple ways to specify the 'tension factor', many in the
statistics community prefer the 'equivalent degrees of freedom' so  
you
will often see df=___ in the examples.  You can also directly  
enter a

penalty mulitplier.
 To get a clearer answer you would need to give the explicit
definition of "tension factor" from the literature you are quoting.
It's not just that different disciplines rediscover the same ideas,
they
also relabel them.

Terry Therneau

__
R-help@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.


__
R-help@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.


David Winsemius, MD
West Hartford, CT

__
R-help@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.


David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] Splines under tension

2010-05-12 Thread Peter Ehlers

On 2010-05-12 12:41, David Winsemius wrote:


On May 12, 2010, at 2:37 PM, Greg Snow wrote:


I think this last line is a fortune candidate:

It's not just that different disciplines rediscover the same ideas,
they also relabel them.



With apologies to Aretha: I second that emotion.



I'm sure Aretha won't mind if I add my voice to the chorus.

--
Peter Ehlers
University of Calgary

__
R-help@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.


Re: [R] Splines under tension

2010-05-12 Thread David Winsemius


On May 12, 2010, at 2:37 PM, Greg Snow wrote:


I think this last line is a fortune candidate:

It's not just that different disciplines rediscover the same ideas,  
they also relabel them.




With apologies to Aretha: I second that emotion.

--
David.



--
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111



-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
project.org] On Behalf Of Terry Therneau
Sent: Wednesday, May 12, 2010 6:49 AM
To: sam.e
Cc: r-help@r-project.org
Subject: Re: [R] Splines under tension

---begin included message ---

Does anyone know if R has a function for splines under tension. I  
know

there are numerous packages for spline interpolation within R i just
can't find one that lets you determine the tension factor.

--

In the statistics literature these are called "smoothing splines".   
For

instance the s(x) construct in gam or pspline(x) in a coxph formula.
There are multiple ways to specify the 'tension factor', many in the
statistics community prefer the 'equivalent degrees of freedom' so  
you

will often see df=___ in the examples.  You can also directly enter a
penalty mulitplier.
  To get a clearer answer you would need to give the explicit
definition of "tension factor" from the literature you are quoting.
It's not just that different disciplines rediscover the same ideas,
they
also relabel them.

Terry Therneau

__
R-help@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.


__
R-help@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.


David Winsemius, MD
West Hartford, CT

__
R-help@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.


Re: [R] Splines under tension

2010-05-12 Thread Greg Snow
I think this last line is a fortune candidate:

It's not just that different disciplines rediscover the same ideas, they also 
relabel them.


-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.s...@imail.org
801.408.8111


> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-
> project.org] On Behalf Of Terry Therneau
> Sent: Wednesday, May 12, 2010 6:49 AM
> To: sam.e
> Cc: r-help@r-project.org
> Subject: Re: [R] Splines under tension
> 
> ---begin included message ---
> 
> Does anyone know if R has a function for splines under tension. I know
> there are numerous packages for spline interpolation within R i just
> can't find one that lets you determine the tension factor.
> 
> --
> 
> In the statistics literature these are called "smoothing splines".  For
> instance the s(x) construct in gam or pspline(x) in a coxph formula.
> There are multiple ways to specify the 'tension factor', many in the
> statistics community prefer the 'equivalent degrees of freedom' so you
> will often see df=___ in the examples.  You can also directly enter a
> penalty mulitplier.
>To get a clearer answer you would need to give the explicit
> definition of "tension factor" from the literature you are quoting.
> It's not just that different disciplines rediscover the same ideas,
> they
> also relabel them.
> 
> Terry Therneau
> 
> __
> R-help@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.

__
R-help@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.


Re: [R] Splines under tension

2010-05-12 Thread Terry Therneau
---begin included message ---

Does anyone know if R has a function for splines under tension. I know
there are numerous packages for spline interpolation within R i just
can't find one that lets you determine the tension factor.

--

In the statistics literature these are called "smoothing splines".  For
instance the s(x) construct in gam or pspline(x) in a coxph formula.
There are multiple ways to specify the 'tension factor', many in the
statistics community prefer the 'equivalent degrees of freedom' so you
will often see df=___ in the examples.  You can also directly enter a
penalty mulitplier.  
   To get a clearer answer you would need to give the explicit
definition of "tension factor" from the literature you are quoting.
It's not just that different disciplines rediscover the same ideas, they
also relabel them.

Terry Therneau

__
R-help@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.


[R] Splines under tension

2010-05-11 Thread sam.e

Does anyone know if R has a function for splines under tension. I know there
are numerous packages for spline interpolation within R i just can't find
one that lets you determine the tension factor.

Any help would be much appreciated!

Sam
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Splines-under-tension-tp2173887p2173887.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@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.


[R] Splines and piecewise polynomials

2007-11-13 Thread Christopher J. Ruwe
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Dear R-Users!

I am trying to  fit a spline to a time-series with about 90 values.
I would like to specify about four to five knots and I would like the
values returned to be similar in fashion to the output of interpSpline -
  I would only like the spline to be constructed not with every point of
data as a knot, but with significantly less knots.

- From the plenty of packages available concerning splines, I have not
understood how to extract the piecewise polynomial \textit{functions}
instead of the fitted values, as I would like to integrate these and
therefor need to be able to construct a class polynomial.

Thank you very much for your help, have a nice evening
Christopher J. Ruwe
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHOg+rEnhHZG9ORx4RAla1AJ0XdjFg5DPXkJ0LGkjUVxNqLfT5KgCaAj5A
+OJKipjVUMG1EI/7g0Z6AoM=
=a4bq
-END PGP SIGNATURE-

__
R-help@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.


Re: [R] Splines

2007-10-05 Thread Wayne.W.Jones
smooth.spline is a handy function and does what you need: 
Careful to not over fit though. Use different values of spar and df.


y<-c(467, 468, 460 ,460 ,450, 432, 419, 420, 423, 423)
x<-1:10
plot(x,y)
predict(smooth.spline(x,y,df=4),x=3.5)
lines(predict(smooth.spline(x,y,df=4),x=seq(1,10,length=100)),col="red",lwd=2)
lines(predict(smooth.spline(x,y,df=8),x=seq(1,10,length=100)),col="red",lwd=2)






-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of stat stat
Sent: 05 October 2007 09:31
To: [EMAIL PROTECTED]
Subject: [R] Splines


I want to fit a cubic spline of x on y. where :
   
  x
 [1] 467 468 460 460 450 432 419 420 423 423
y
 [1]  1  2  3  4  5  6  7  8  9 10
   
  using the syntax
   
  spline(y, x)
   
  I got following output :
   
  $x
 [1]  1.00  1.310345  1.620690  1.931034  2.241379  2.551724  2.862069
 [8]  3.172414  3.482759  3.793103  4.103448  4.413793  4.724138  5.034483
[15]  5.344828  5.655172  5.965517  6.275862  6.586207  6.896552  7.206897
[22]  7.517241  7.827586  8.137931  8.448276  8.758621  9.068966  9.379310
[29]  9.689655 10.00
  $y
 [1] 467. 469.5381 469.8643 468.4865 465.9444 463.0284 460.6479 459.6560
 [9] 459.8737 460.2296 459.6313 457.4921 454.0094 449.4482 444.1040 438.3613
[17] 432.6204 427.2892 422.8183 419.6733 418.2646 418.3633 419.3283 420.5202
[25] 421.5768 422.4555 423.1312 423.5419 423.5480 423.

  Now I want to get what is the value of y at x = 5.25. Can anyone tell me how 
to find that?
   


thanks in advance
   
-
 Meet people who discuss and share your passions.  Join them now.
[[alternative HTML version deleted]]

__
R-help@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.

__
R-help@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.


Re: [R] Splines

2007-10-05 Thread vito muggeo
As reported in ?spline, you should use splinefun() instead.

ff<-splinefun(x,y)
ff(x0)

where x0=5.25 is your case.

best,

vito


stat stat ha scritto:
> I want to fit a cubic spline of x on y. where :
>
>   x
>  [1] 467 468 460 460 450 432 419 420 423 423
> y
>  [1]  1  2  3  4  5  6  7  8  9 10
>
>   using the syntax
>
>   spline(y, x)
>
>   I got following output :
>
>   $x
>  [1]  1.00  1.310345  1.620690  1.931034  2.241379  2.551724  2.862069
>  [8]  3.172414  3.482759  3.793103  4.103448  4.413793  4.724138  5.034483
> [15]  5.344828  5.655172  5.965517  6.275862  6.586207  6.896552  7.206897
> [22]  7.517241  7.827586  8.137931  8.448276  8.758621  9.068966  9.379310
> [29]  9.689655 10.00
>   $y
>  [1] 467. 469.5381 469.8643 468.4865 465.9444 463.0284 460.6479 459.6560
>  [9] 459.8737 460.2296 459.6313 457.4921 454.0094 449.4482 444.1040 438.3613
> [17] 432.6204 427.2892 422.8183 419.6733 418.2646 418.3633 419.3283 420.5202
> [25] 421.5768 422.4555 423.1312 423.5419 423.5480 423.
> 
>   Now I want to get what is the value of y at x = 5.25. Can anyone tell me 
> how to find that?
>
> 
> 
> thanks in advance
>
> -
>  Meet people who discuss and share your passions.  Join them now.
>   [[alternative HTML version deleted]]
> 
> __
> R-help@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.
> 
> 

-- 

Vito M.R. Muggeo
Dip.to Sc Statist e Matem `Vianelli'
Università di Palermo
viale delle Scienze, edificio 13
90128 Palermo - ITALY
tel: 091 6626240
fax: 091 485726/485612

__
R-help@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.


[R] Splines

2007-10-05 Thread stat stat
I want to fit a cubic spline of x on y. where :
   
  x
 [1] 467 468 460 460 450 432 419 420 423 423
y
 [1]  1  2  3  4  5  6  7  8  9 10
   
  using the syntax
   
  spline(y, x)
   
  I got following output :
   
  $x
 [1]  1.00  1.310345  1.620690  1.931034  2.241379  2.551724  2.862069
 [8]  3.172414  3.482759  3.793103  4.103448  4.413793  4.724138  5.034483
[15]  5.344828  5.655172  5.965517  6.275862  6.586207  6.896552  7.206897
[22]  7.517241  7.827586  8.137931  8.448276  8.758621  9.068966  9.379310
[29]  9.689655 10.00
  $y
 [1] 467. 469.5381 469.8643 468.4865 465.9444 463.0284 460.6479 459.6560
 [9] 459.8737 460.2296 459.6313 457.4921 454.0094 449.4482 444.1040 438.3613
[17] 432.6204 427.2892 422.8183 419.6733 418.2646 418.3633 419.3283 420.5202
[25] 421.5768 422.4555 423.1312 423.5419 423.5480 423.

  Now I want to get what is the value of y at x = 5.25. Can anyone tell me how 
to find that?
   


thanks in advance
   
-
 Meet people who discuss and share your passions.  Join them now.
[[alternative HTML version deleted]]

__
R-help@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.