There is some terminology confusion here... interpolation as implemented by
approx or spline usually means estimating values between known points. You
seem to have approximate (not known) points, and are looking to apply a linear
regression model to estimate missing data. Beware that mixing est
Jan,
There are a lot of packages that can help you, the best one depends on
your needs (with or without prediction uncertainty, format of results,
different options) and the size of your problem.
CRAN has a spatial Task View
http://cran.r-project.org/web/views/Spatial.html
with a short descrip
On Sat, Jun 16, 2012 at 8:19 AM, stef salvez wrote:
> I have a panel data set (in MS excel) like the one below
>
>
> 1 "23/11/08" 2
> 1 "28/12/08" 3
> 1 "25/01/09" 4
> 1 "22/02/09" 5
> 1 "29/03/09"
Hi Ken, Stef,
We can make your script more elegant like below:
On Sun, Jun 17, 2012 at 12:52 AM, Ken wrote:
>
> stef salvez googlemail.com> writes:
[snip]
> #load library
> library(plyr)
>
> # utility function
> mean.var = function(df, var){ mean(df[[var]], na.rm = T)};
>
> # create example
stef salvez googlemail.com> writes:
>
> I would like to clarify that since each observation is obtained every
> 28 days, each such observation is a 4-week average
>
> thanks
>
> On 6/16/12, stef salvez googlemail.com> wrote:
> > I have a panel data set (in MS excel) like the one below
> >
>
I would like to clarify that since each observation is obtained every
28 days, each such observation is a 4-week average
thanks
On 6/16/12, stef salvez wrote:
> I have a panel data set (in MS excel) like the one below
>
>
> 1 "23/11/08"2
> 1 "28/12/08" 3
On Wed, Apr 18, 2012 at 07:15:45AM -0700, uday wrote:
> hi Petr ,
> Thanks for replay and sorry for typo mistake
> approx(pres, sci.pre) its nothing but approx(pre2, pre1).
>
> so for more simplicity
> x <- c(10.34615 , 52.02116, 146.17357, 243.28644, 347.41504, 431.67105,
> 521.4
Your problem is that length(x) != length(y)
approx uses linear interpolation but there's no way to make sense of
that if you can't match up the x and y coordinates -- and you can't
match up the x and y coordinates if there aren't the same number of
them.
Michael
On Wed, Apr 18, 2012 at 10:15 AM,
hi Petr ,
Thanks for replay and sorry for typo mistake
approx(pres, sci.pre) its nothing but approx(pre2, pre1).
so for more simplicity
x <- c(10.34615 , 52.02116, 146.17357, 243.28644, 347.41504, 431.67105,
521.42712, 629.00446 ,729.95941, 827.86279, 921.55078,
956.6)
y <- c(
On Wed, Apr 18, 2012 at 03:55:07AM -0700, uday wrote:
> This moment I got stuck with one interpolation issue
> the sample data which I have is as follows
>
> pre1 <- c(10.34615 , 52.02116, 146.17357, 243.28644, 347.41504, 431.67105,
> 521.42712, 629.00446 ,729.95941,82
On Jun 1, 2011, at 9:24 AM, Clement LAUZIN wrote:
Hello,
I have a x,y,z file.Z is not corresponding to a simple analytical
function of x and y (see below).
I am trying to find the minimum location of this surface and the z
value corresponding to this location by a spline interpolation or
Clement LAUZIN hotmail.com> writes:
> Hello,
>
> Hello,
>
> I have a x,y,z file.Z is not corresponding to a simple analytical function
> of x and y (see below). I am trying to find the minimum location of this
> surface and the z value corresponding to this location by a spline
> interpolation
Hi:
Look into the na.approx() function in package zoo. The discussion below may
be of help:
http://r.789695.n4.nabble.com/Filling-in-missing-time-samples-with-na-approx-td3063682.html
HTH,
Dennis
On Wed, Jan 5, 2011 at 10:17 PM, Rustamali Manesiya wrote:
> Hello,
>
>
> I am new to R and n
try packages:
{yaImpute}, {impute}, etc.
--
View this message in context:
http://r.789695.n4.nabble.com/Interpolation-missing-data-tp2530871p2531288.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
ht
The warning message simply indicates that you have more than one data point
with the same "x" value. So, `approx' collapses over the dulicate x values
by averaging the corresponding "y" values. I am not sure if this is your
problem - it doesn't seem like it. It is doing what seems reasonable for
Why not look into the zoo package na.approx? And related functions.
On Thu, Jan 28, 2010 at 11:29 AM, ogbos okike wrote:
> Happy New Year.
> I have a data of four columns - year, month, day and count. The last column,
> count, contains some missing data which I have to replace with NA. I tried
>
On Jan 11, 2010, at 11:49 AM, René Mayer wrote:
My problem is that x values increas with y
x is mostly decreasing in the order you presented:
plot(x, type="l")
until some point then the pattern
reverses. The whole line
which line?
is a kind of U-shape with a right-buttom to middel-top d
My problem is that x values increas with y until some point then the pattern
reverses. The whole line is a kind of U-shape with a right-buttom to
middel-top diagonal at the end of it (a look at the plot makes it
clearer). The interpolation (approx, spline) makes a zick-zack aut of
it. What I
On Jan 11, 2010, at 7:44 AM, René Mayer wrote:
Dear R-users,
I have a complex line by xy-values (ordered by z).
And I would like to get interpolated y-values on the positions of x
= 0:600.
How do I get the correct points?
x
=
c
(790,790,790,790,790,786,783,778,778,766,763,761,761,761,715
It appears the answer to your goal after a discursive exploration of
"interpolation", which was really extrapolation, is that you need to
look at the predict methods for linear (and other sorts as well) models.
?predict
?predict.lm
> y <- c(16,45,77,101,125)
> x <- c(0,5,10,15,20)
>
> lmmo
On Jan 15, 2009, at 11:31 AM, e-letter wrote:
Perhaps a coding error on my part (or on your part). Perhaps
different
methods (none of which you describe)?
I suspect that my method only used the first two points (I just
checked by plotting and -2.7 is closer to the paper and pen result I
g
> Perhaps a coding error on my part (or on your part). Perhaps different
> methods (none of which you describe)?
>
> I suspect that my method only used the first two points (I just
> checked by plotting and -2.7 is closer to the paper and pen result I
> get than is -3.28. Perhaps you made an extra
On Jan 15, 2009, at 10:04 AM, e-letter wrote:
On 13/01/2009, David Winsemius wrote:
It's fairly clear from the documentation that approxfun() will not
extrapolate.
help.search("extrapolate")
library(Hmisc)
?approxExtrap
Some sort of minimization approach:
approxExtrap(x=c(0,5,10,15,20),
On 13/01/2009, David Winsemius wrote:
> It's fairly clear from the documentation that approxfun() will not
> extrapolate.
>
> help.search("extrapolate")
> library(Hmisc)
> ?approxExtrap
>
> Some sort of minimization approach:
>
> > approxExtrap(x=c(0,5,10,15,20), y=c(16,45,77,101,125),xout=c(-4,0
It's fairly clear from the documentation that approxfun() will not
extrapolate.
help.search("extrapolate")
library(Hmisc)
?approxExtrap
Some sort of minimization approach:
> approxExtrap(x=c(0,5,10,15,20), y=c(16,45,77,101,125),xout=c(-4,0,4))
$x
[1] -4 0 4
$y
[1] -7.2 16.0 39.2
> approxE
>
> What is the problem that you are trying to solve?
>
>From the data I provided: x=c(0,5,10,15,20) y=c(16,45,77,101,125); I
want to obtain the value of x when y=0.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE
approxfun returns a function; that is not an error message:
> x=c(0,5,10,15,20)
> y=c(16,45,77,101,125)
>
> approx(x,y,method="linear")
$x
[1] 0.000 0.4081633 0.8163265 1.2244898 1.6326531 2.0408163
2.4489796 2.8571429 3.2653061
[10] 3.6734694 4.0816327 4.4897959 4.8979592 5.306
On 08/01/2009, Greg Snow wrote:
> If you want to just linearly interpolate, then use the functions approx or
> approxfun from the stats package (one of those that is loaded by default).
I have read the guide for approx and approxfun functions. Below is my data.
x=c(0,5,10,15,20)
y=c(16,45,77,101,
If you want to just linearly interpolate, then use the functions approx or
approxfun from the stats package (one of those that is loaded by default). See
the function TkApprox in the TeachingDemos package for an interactive way to
plot the approximations with the interpolations plotted.
Hope
Thank you very much, You have helped me to resolve the problem.
Thank you!!
A greetings, Luismi
Henrique Dallazuanna wrote:
>
> I think that you can use the splinefun function:
>
> f <- splinefun(x, y)
>
> f(15)
>
> On Thu, Sep 4, 2008 at 1:52 PM, ermimi <[EMAIL PROTECTED]> wrote:
>
>>
I think that you can use the splinefun function:
f <- splinefun(x, y)
f(15)
On Thu, Sep 4, 2008 at 1:52 PM, ermimi <[EMAIL PROTECTED]> wrote:
>
> Hello friends!!!
>
> I have a list of values called y.
> The list is y=c(221.0, 212.0, 206.0, 202.7, 198.4, 195.1, 192.2, 189.7,
> 187.6, 185.8);
> y
Hi Steve,
It could be the case that you are trying to find values that are not in
the range of values you are providing.
For example,
x <- c(1,2,3,4,5)
y <- c(10,11,12,13,14)
xout <- c(0.01,0.02)
approx(x,y,xout,method="linear")
R's output:
$x
[1] 0.01 0.02
$y
[1] NA NA
If you want to see th
Steve Murray hotmail.com> writes:
>
>
> Thanks Duncan - a couple of extra points... I should have perhaps pointed
> out that the data are on a *regular*
> 'box' grid (with each value currently spaced at 1 degree intervals). Also,
> I'm looking for something
> fairly simple, like a bilinear i
again,
Steve
> Date: Mon, 1 Sep 2008 18:45:35 -0400
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> CC: r-help@r-project.org
> Subject: Re: [R] Interpolation Problems
>
> On 01/09/2008 6:17 PM, Steve Murray wrote:
>> Dear all,
>>
>> I'm trying to inte
On 01/09/2008 6:17 PM, Steve Murray wrote:
Dear all,
I'm trying to interpolate a dataset to give it twice as many values (I'm giving
the dataset a finer resolution by interpolating from 1 degree to 0.5 degrees)
to match that of a corresponding dataset.
I have the data in both a data frame for
Does this thread solve your problem? ->
https://stat.ethz.ch/pipermail/r-help/2007-July/136814.html
On 10-Jul-08, at 3:15 AM, [EMAIL PROTECTED] wrote:
Hello,
I have the data whcih are not balanced (several missing observations),
and one possibility is t use interpolation method
to get the inf
Try
help.search('interpolate')
and
help.search('impute')
(most of the responses to the latter come from packages that you may
not have installed, such as Hmisc)
-Don
At 8:15 AM +0200 7/10/08, [EMAIL PROTECTED] wrote:
Hello,
I have the data whcih are not balanced (several missing observ
if it is a time series the interpolation methods in zoo are an option.
On Thu, Jul 10, 2008 at 6:41 AM, Daniel Malter <[EMAIL PROTECTED]> wrote:
>
> Please do read the posting guide. Please provide self-contained code (e.g.
> to
> randomly generate data) and illustrate (e.g. in a small table) wha
Please do read the posting guide. Please provide self-contained code (calls
to randomly generated data) and illustrate (e.g. in a small table) what you
want to do and also illustrate (with the self-contained code) where your
current approach (if any) fails. After reading your message, I have only
Hello,
I tried the approx() and it worked. Now, I have a list named "interpol"
resulting from the interpolation. I would like to append the values in
interpol$y in the position specified by interpol$x in a existing vector
"spect1". I tried with append() and the following code:
spect1 <- c(1:109
check out the 'approx' function.
On Feb 19, 2008 12:44 PM, Dani Valverde <[EMAIL PROTECTED]> wrote:
> Hello,
> I have two vectors, one with 13112 points and the other one with 10909.
> I wonder if there is a way to interpolate the data so the shorter
> vectors has the same number of points as the
Maybe arima with the xreg= argument.
On 10/11/07, Creighton, Sean <[EMAIL PROTECTED]> wrote:
> Hi
>
> I have a collection of about 16 time series with occasional missing
> data. A few of these time-series start later than the rest. There is a
> relatively high correlation between them (they are ho
42 matches
Mail list logo