Dear,

So What I'm looking at is the effect of age on the functional connectivity in a certain brain network. I have the ages of different subjects as x-values and values representing this functional connectivity with a region of intrest. This values are always for one voxel. But I found a whole cluster with higher connectivity in younger peoply so I wanted to use the values of different voxels of this cluster except of only the values of the voxel with the biggest t-value.
The script I used is described below (short version with only 5 subjects). The reason whe used DierckSpline is that when you just fit a line it looks like a line with a "knot" would better fit the data.

Age<-c(23,24,25,25,25)
Connectivity<-c(0.453,0.628,0.518,-0.060,0.384)

DF<-data.frame(cbind(Age,Connectivity))
plot(Age,Connectivity)
splinefit<-with(DF, curfit.free.knot(Age, Connectivity, k=1, g=1, prior=NULL))

splinefit

xfit1<-c(Age[1],splinefit$knots[3])   
xfit2<-c(splinefit$knots[3],Age[length(Age)])

yfit1<-c(splinefit$coef[1],splinefit$coef[2])
yfit2<-c(splinefit$coef[2],splinefit$coef[3])

lines(xfit1,yfit1)
lines(xfit2,yfit2)

I already tried to add some sets of y-values in the script but I always get errors. Such as "invalid plot type".
 The problem is that I'm not at all familiar with the "language" used for this scripts so it's very difficult to find the right sollution.
I also looked at the information about thin plate splines but I don't think that's what I need.

Thank you already for helping me in the right direction, I hope is a little easier to understand now what I'm doing.

Elisabeth Jonckers

  





Dear Elisabeth: 

      Have you tried it?  I have not, but I suspect the answer is "no". 

      What problem are you trying to solve?  You might get more useful 
suggestions from this list if you provide commented, minimal, 
self-contained, reproducible code describing your problem and what 
you've tried to solve it, as suggested in the posting guide 
"www.R-project.org/posting-guide.html". 

      With fmri images, I might look first at the "fields" package, 
because it is explicitly designed for "curve, surface and function 
fitting with an emphasis on splines, spatial data and spatial 
statistics. The major methods include cubic, robust, and thin plate 
splines, multivariate Kriging and Kriging for large data sets."  I have 
not used it, but it sounds to me like you might want thin plate 
splines.  Paul Dierckx (1993) Curve and Surface Fitting with Splines 
(Oxford Science Publications) discusses thin plate splines, and Dierckx 
wrote Fortran to fit them.  However, the "DierckxSpline" package does 
not currently connect to those capabilities. 

      If univariate splines would do, I might start with the "fda" 
package.  The theory behind that is documented in two books by Ramsay 
and Silverman. 

      Hope this helps. 
      Spencer Graves

Jonckers Elisabeth wrote:
> Dear "R" users,
>
> I have a question about the Package DierckxSpline. I have tried to find the answer by myself but it didn't worked out.
>
> I wondered if Dierckxspline can use different sets of y values in one time to fit a line with knot. I have different sets of Y values representing the same thing for different voxels (in an fmri image). I have already fitted the data in different graphs and I know now that the plots are comparable for the different data sets (so for the different voxels) but I wanted to include all the information in one plot, If it's possible. So I want to know the best fitting line for the whole cluster of voxels except for one voxel.
> If there is no possibility to do this I tought it would be an option to take the mean of the different y-values and use those values but I don't know if this is mathematical right to do.
> I hope someone can help me with this.
>
> Thank you very much,
> Elisabeth Jonckers
> GIfMI
> Ghent University Hospital
> Belgium
>
> 	[[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.






	[[alternative HTML version deleted]]


