Displaying 20 results from an estimated 7000 matches similar to: "Obtaining the value of x at a given value of y in a smooth.spline object"
2011 Mar 12
2
Identifying unique pairs
Dear R helpers
Suppose I have a data frame as given below
mydat = data.frame(x = c(1,1,1, 2, 2, 2, 2, 2, 5, 5, 6), y = c(10, 10, 10, 8, 8, 8, 7, 7, 2, 2, 4))
mydat
x y
1 1 10
2 1 10
3 1 10
4 2 8
5 2 8
6 2 8
7 2 7
8 2 7
9 5 2
10 5 2
11 6 4
unique(mydat$x) will give me 1,
2009 Oct 02
6
split-apply question
Hi,
I have a data frame that looks like this:
>x
x1 x2 x3
A 1 1.5
B 2 0.9
B 3 2.7
C 7 1.8
D 7 1.3
I want to "group" by the x1 column and in the case of multiple x$x1 values
(e.g., "B")d, return rows that have the smallest values of x2. In the case
of rows with only one value of x1 (e.g., "A"), return the row as is. How can
I do that?
2010 Mar 20
2
Converting a character string into a data frame name and performing assignments to that data frame
Hi,
I would like to do the following operations:
variable.df is a character string that contains the name of the data
frame that I want to do the following operations on:
variable.df <- data.frame();
# I can do the above command using
assign( variable.df, data.frame() )
How can I perform the assignment statements below ?
colnames(variable.df) = colnames(some.other.df)
variable.df =
2009 Jun 28
1
applying a function to a pair of components for each row of a list
Hi,
I have a set of (x,y) coordinate pairs that are stored as a list
> my_list
$x
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25
$y
[1] -8.0866819 -7.3876052 -6.6849311 -5.9837693 -5.2967432 -4.6525466
[7] -4.0999453 -3.6556190 -3.3076102 -3.0360780 -2.8220465 -2.6532085
[13] -2.5192816 -2.4086241 -2.3072977 -2.1969611 -2.0574250 -1.8737694
[19] -1.6357864
2009 Oct 22
1
tapply with multiple arguments that are not part of the same data frame
Hi all,
I would like to invoke a function that takes multiple arguments (some of
which are specified columns in the data frame, and others that are
independent of the data frame) on split parts of a data frame, how do I do
this?
For example, let's say I have a data frame
>fitness_data
name height weight country
rob 5.8 200 usa
nancy 5.5 140 germany
jen
2008 Aug 25
1
small spline regression example
Dear R People:
Could someone recommend a small example for spline regression, please?
I would like to show this to my students, step by step.
Thanks in advance,
Erin
--
Erin Hodgess
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: erinm.hodgess at gmail.com
2003 May 23
2
predict.smooth.spline
I'm using R 1.7.0 on linux. With this version of R the package modreg is
automatically loaded at start of session. However attempting to use
predict.smooth.spline() produces Error: couldn't find function
predict.smooth.spline.
The function smooth.spline() is OK. What am I missing?
======================================
I.White
ICAPB, University of Edinburgh
Ashworth Laboratories, West
2011 Aug 25
3
Application of results from smooth.spline outside R
Hi,
I want to use the result from smooth.spline outside R.
I take my data ,which is 180 point stored in x and y
s <- smooth(x,y)
I can know use to e.g. find the interpolated value at e.g. x=500
predict (s,500)
My problem is, that i don't know how to implement the predict function. I
have looked at literature, but i cannot connect the output of the
smooth.spline() to an actual spline
2006 Mar 17
1
smooth.spline
I have noticed a slightly puzzling behaviour exhibited by
smooth.spline(). If I do
sss <- smooth.spline(x,y)
for a certain pair of data vectors x and y, and then do
length(sss$x)
I get the result ``18''. However if I do
length(unique(x))
I get ``27''. Trying to force smooth.spline() to use more knots I
tried
sss <- smooth.spline(x,y,all.knots=TRUE)
but again
2012 Feb 24
1
B-spline/smooth.basis derivative matrices
Hello,
I've noticed that SPLUS seems to have a function for evaluating derivative matrices of splines. I've found the R function that evaluates matrices from 'smooth.spline'; maybe someone has written something to do the same with smooth.basis?
regards,
s
2007 Jul 04
3
Problem/bug with smooth.spline and all.knots=T
Dear list,
if I do
smooth.spline(tmpSec, tmpT, all.knots=T)
with the attached data, I get this error-message:
Error in smooth.spline(tmpSec, tmpT, all.knots = T) :
smoothing parameter value too small
If I do
smooth.spline(tmpSec[-single arbitrary number], tmpT[-single arbitrary number], all.knots=T)
it works!
I just don't see it. It works for hundrets other datasets, but not for
2003 Apr 08
5
Help on smooth.spline?
Hey, R-listers
I was recommended to try using smooth.spline function
for estimating 2-Dimensinal curve given a data set.
So will you please tell me where to get this R function?
Or which package provides this function?
Thanks for your point.
Fred
2012 Feb 15
1
smooth.spline() unique 'x' values error
Hello.
I'm getting an unexpected result when running smooth.spline(). Here is a simple example that replicates the error I'm getting:
> aa <- c(1, 2, 3, 8, 8, 8, 8, 8, 8, 8, 8, 8, 12, 13, 14)
> bb <- 1:length(aa)
> plot(aa, bb)
> smooth.spline(aa, bb)
Error in smooth.spline(aa, bb) : need at least four unique 'x' values
As you can see from the example, my
2006 Jun 24
3
getting the smoother matrix from smooth.spline
Can anyone tell me the trick for obtaining the smoother matrix from smooth.spline when there are non-unique values for x. I have the following code but, of course, it only works when all values of x are unique.
## get the smoother matrix (x having unique values
smooth.matrix = function(x, df){
n = length(x);
A = matrix(0, n, n);
for(i in 1:n){
y = rep(0, n); y[i]=1;
yi =
2009 Mar 28
1
Find inflection points using smooth.spline
Is there any way to identify or infer the inflection points in a smooth
spline object? I am doing a comparison of various methods of time-series
analysis (polynomial regression, spline smoothing, recursive partitioning)
and I am specifically interested in obtaining the julian dates associated
with the inflection points inferred by the various models.
Tyler
e.g.
2008 Jul 17
1
smooth.spline
I like what smooth.spline does but I am unclear on the output. I can see from the documentation that there are fit.coef but I am unclear what those coeficients are applied to.With spline I understand the "noraml" coefficients applied to a cubic polynomial. But these coefficients I am not sure how to interpret. If I had a description of the algorithm maybe I could figure it out but as it
2008 Jun 05
1
Smooth Spline
Hi,
I have three original curves as follows,
n<-seq(20,200,by=10)
t<-c(0.1138, 0.1639, 0.2051, 0.2473, 0.2890, 0.3304, 0.3827, 0.4075, 0.4618, 0.4944,
0.5209, 0.5562, 0.5935, 0.6197, 0.6523, 0.6771, 0.6984, 0.7209, 0.7453)
es<-c(0.3682, 0.4268, 0.5585, 0.6095, 0.7023, 0.7534, 0.8225, 0.8471, 0.8964, 0.9098, 0.9371, 0.9514, 0.9685, 0.9747, 0.9812, 0.9859, 0.9905, 0.9923, 0.9940)
2016 Jul 09
2
Red Neuronal complicada categorías
Hola,
Esta es una forma de hacerlo...
Mira que lo primero que he modificado es el fichero "x.csv" para sustituir
los espacios en los nombres por "_". Y también he quitado los acentos y las
eñes...
He utilizado el paquete RNNS y la función "mlp()" para ajustar la red.
#-------------------------------------------
> x <- read.csv("x.csv",
2001 Apr 26
3
Installing smooth.spline command
Hello
I have installed R-0.90.1 on my Linux (Redhat 6.2) machine,
unfortunately I am not able to use a number of commands like e.g.
smooth.spline and predict.smooth.spline.
The error messages being given by is:
Error: Object "smooth.spline" not found
With the command library() I have checked or the libraries for the
smoothing functions are there, as shown below.
--------
>
2006 Apr 05
1
predict.smooth.spline.fit and Recall() (Was: Re: Return function from function and Recall())
Hi,
forget about the below details. It is not related to the fact that
the function is returned from a function. Sorry about that. I've
been troubleshooting soo much I've been shoting over the target. Here
is a much smaller reproducible example:
x <- 1:10
y <- 1:10 + rnorm(length(x))
sp <- smooth.spline(x=x, y=y)
ypred <- predict(sp$fit, x)
# [1] 2.325181 2.756166 ...