Help with implementing Whittaker-Henderson graduation for raw-data

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Help with implementing Whittaker-Henderson graduation for raw-data

Percival Bueser
Good day everyone!

I would appreciate if anyone can help me regarding the following: I would
like to implement the Whittaker-Henderson smoothing to the raw data on the
attached .txt file, based on the description on this link:

https://artax.karlin.mff.cuni.cz/r-help/library/pracma/html/whittaker.html

On the attached .txt file, The x's are the independent variables and the y's
are the dependent variables. The signal to be smoothed is y, lambda = 1600
and d = 2.

Can anyone please send me a sample R script, or a link to an R script which
I can adapt, where I can get both the (1) smoothed graph and the (2)
smoothed values of y for each x given, and then import both the smoothed
graph and the smoothed values of y to Microsoft Excel?

Thank you very much.

Regards,

Percy



______________________________________________
[hidden email] 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.

Sample_data.txt (186 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Help with implementing Whittaker-Henderson graduation for raw-data

Bert Gunter-2
Percival:

Please make at least a minimal effort to search before posting.

 A google search on "Whittaker-Henderson smoothing R" brought up what
appeared to me to be several relevant links. If I am wrong about this,
you should probably explain why in a further query.

Of course, in general, we do not write your code for you. This is just
"r-help" not a free r programming service. You need to show us your
code and the errors you got when you attempted to run it.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Feb 1, 2017 at 6:44 PM, Percival Bueser
<[hidden email]> wrote:

> Good day everyone!
>
> I would appreciate if anyone can help me regarding the following: I would
> like to implement the Whittaker-Henderson smoothing to the raw data on the
> attached .txt file, based on the description on this link:
>
> https://artax.karlin.mff.cuni.cz/r-help/library/pracma/html/whittaker.html
>
> On the attached .txt file, The x's are the independent variables and the y's
> are the dependent variables. The signal to be smoothed is y, lambda = 1600
> and d = 2.
>
> Can anyone please send me a sample R script, or a link to an R script which
> I can adapt, where I can get both the (1) smoothed graph and the (2)
> smoothed values of y for each x given, and then import both the smoothed
> graph and the smoothed values of y to Microsoft Excel?
>
> Thank you very much.
>
> Regards,
>
> Percy
>
>
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Help with implementing Whittaker-Henderson graduation for raw-data

Berend Hasselman
In reply to this post by Percival Bueser

Why don't you just try the function whittaker from the pracma R package?
There is an example which should be adequate for finding out what to do.

Berend Hasselman

> On 2 Feb 2017, at 03:44, Percival Bueser <[hidden email]> wrote:
>
> Good day everyone!
>
> I would appreciate if anyone can help me regarding the following: I would
> like to implement the Whittaker-Henderson smoothing to the raw data on the
> attached .txt file, based on the description on this link:
>
> https://artax.karlin.mff.cuni.cz/r-help/library/pracma/html/whittaker.html
>
> On the attached .txt file, The x's are the independent variables and the y's
> are the dependent variables. The signal to be smoothed is y, lambda = 1600
> and d = 2.
>
> Can anyone please send me a sample R script, or a link to an R script which
> I can adapt, where I can get both the (1) smoothed graph and the (2)
> smoothed values of y for each x given, and then import both the smoothed
> graph and the smoothed values of y to Microsoft Excel?
>
> Thank you very much.
>
> Regards,
>
> Percy
>
>
> <Sample_data.txt>______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Help with implementing Whittaker-Henderson graduation for raw-data

Percival Bueser
In reply to this post by Bert Gunter-2
Good day!

I eventually was able to make the code anyway. Here it is:

getwd()
setwd("C:/R")
datafile <- read.table("test_file.txt", header = TRUE)
library(SparseM)
var2 = datafile$y
d = 2
lambda = 1600
    require(SparseM, warn.conflicts = FALSE)
    m <- length(var2)
    E <- as(m, "matrix.diag.csr")
    class(E) <- "matrix.csr"
    Dmat <- diff(E, differences = d)
    B <- E + (lambda * t(Dmat) %*% Dmat)
    z <- solve(B, var2)
    z
write.table(z, "C:/R/test.txt", sep="\t")  

(then transfer the results to Excel and that's it)

Regards,

Percy



-----Original Message-----
From: Bert Gunter [mailto:[hidden email]]
Sent: Friday, February 3, 2017 12:21 AM
To: Percival Bueser
Cc: R-help
Subject: Re: [R] Help with implementing Whittaker-Henderson graduation for raw-data

Percival:

Please make at least a minimal effort to search before posting.

 A google search on "Whittaker-Henderson smoothing R" brought up what
appeared to me to be several relevant links. If I am wrong about this,
you should probably explain why in a further query.

Of course, in general, we do not write your code for you. This is just
"r-help" not a free r programming service. You need to show us your
code and the errors you got when you attempted to run it.

Cheers,
Bert


Bert Gunter

"The trouble with having an open mind is that people keep coming along
and sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Wed, Feb 1, 2017 at 6:44 PM, Percival Bueser
<[hidden email]> wrote:

> Good day everyone!
>
> I would appreciate if anyone can help me regarding the following: I would
> like to implement the Whittaker-Henderson smoothing to the raw data on the
> attached .txt file, based on the description on this link:
>
> https://artax.karlin.mff.cuni.cz/r-help/library/pracma/html/whittaker.html
>
> On the attached .txt file, The x's are the independent variables and the y's
> are the dependent variables. The signal to be smoothed is y, lambda = 1600
> and d = 2.
>
> Can anyone please send me a sample R script, or a link to an R script which
> I can adapt, where I can get both the (1) smoothed graph and the (2)
> smoothed values of y for each x given, and then import both the smoothed
> graph and the smoothed values of y to Microsoft Excel?
>
> Thank you very much.
>
> Regards,
>
> Percy
>
>
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Help with implementing Whittaker-Henderson graduation for raw-data

Percival Bueser
In reply to this post by Berend Hasselman
Good day!

I eventually was able to make the code anyway. Here it is:

getwd()
setwd("C:/R")
datafile <- read.table("test_file.txt", header = TRUE)
library(SparseM)
var2 = datafile$y
d = 2
lambda = 1600
    require(SparseM, warn.conflicts = FALSE)
    m <- length(var2)
    E <- as(m, "matrix.diag.csr")
    class(E) <- "matrix.csr"
    Dmat <- diff(E, differences = d)
    B <- E + (lambda * t(Dmat) %*% Dmat)
    z <- solve(B, var2)
    z
write.table(z, "C:/R/test.txt", sep="\t")  

(then transfer the results to Excel and that's it)

Now, my problem is:

I'd like to use the following command:
    z2 <- whittaker(var2, lambda, d)
    z2
which will reveal the results using the whittaker function itself.

However, when I use this command
    library(pracma)
I get the following error:

> library(pracma)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]) :
  there is no package called 'quadprog'
Error: package or namespace load failed for 'pracma'

So this must mean that I should have quadprog, but when I tried
    library(quadprog)
before library(pracma), I get the following error:

> library(quadprog)
Error in library(quadprog) : there is no package called 'quadprog'

I'd like to get around these so I can use the whittaker function itself. How
can I do this? Thank you very much.

Regards,

Percy

-----Original Message-----
From: Berend Hasselman [mailto:[hidden email]]
Sent: Friday, February 3, 2017 2:08 AM
To: Percival Bueser
Cc: [hidden email]
Subject: Re: [R] Help with implementing Whittaker-Henderson graduation for
raw-data


Why don't you just try the function whittaker from the pracma R package?
There is an example which should be adequate for finding out what to do.

Berend Hasselman

> On 2 Feb 2017, at 03:44, Percival Bueser <[hidden email]>
wrote:

>
> Good day everyone!
>
> I would appreciate if anyone can help me regarding the following: I would
> like to implement the Whittaker-Henderson smoothing to the raw data on the
> attached .txt file, based on the description on this link:
>
> https://artax.karlin.mff.cuni.cz/r-help/library/pracma/html/whittaker.html
>
> On the attached .txt file, The x's are the independent variables and the
y's
> are the dependent variables. The signal to be smoothed is y, lambda = 1600
> and d = 2.
>
> Can anyone please send me a sample R script, or a link to an R script
which

> I can adapt, where I can get both the (1) smoothed graph and the (2)
> smoothed values of y for each x given, and then import both the smoothed
> graph and the smoothed values of y to Microsoft Excel?
>
> Thank you very much.
>
> Regards,
>
> Percy
>
>
> <Sample_data.txt>______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Help with implementing Whittaker-Henderson graduation for raw-data

Percival Bueser
In reply to this post by Berend Hasselman
Good day!

Problems fixed. Resolutions:

Added
require(pracma, warn.conflicts = FALSE) after library(pracma).

The code is now working. (The examples in the link
https://artax.karlin.mff.cuni.cz/r-help/library/pracma/html/whittaker
show the sample code for the function, but not the prerequisites. I've found
the prerequisites, so thank you very much!)

Regards,

Percy




-----Original Message-----
From: Berend Hasselman [mailto:[hidden email]]
Sent: Friday, February 3, 2017 2:08 AM
To: Percival Bueser
Cc: [hidden email]
Subject: Re: [R] Help with implementing Whittaker-Henderson graduation for
raw-data


Why don't you just try the function whittaker from the pracma R package?
There is an example which should be adequate for finding out what to do.

Berend Hasselman

> On 2 Feb 2017, at 03:44, Percival Bueser <[hidden email]>
wrote:

>
> Good day everyone!
>
> I would appreciate if anyone can help me regarding the following: I would
> like to implement the Whittaker-Henderson smoothing to the raw data on the
> attached .txt file, based on the description on this link:
>
> https://artax.karlin.mff.cuni.cz/r-help/library/pracma/html/whittaker.html
>
> On the attached .txt file, The x's are the independent variables and the
y's
> are the dependent variables. The signal to be smoothed is y, lambda = 1600
> and d = 2.
>
> Can anyone please send me a sample R script, or a link to an R script
which

> I can adapt, where I can get both the (1) smoothed graph and the (2)
> smoothed values of y for each x given, and then import both the smoothed
> graph and the smoothed values of y to Microsoft Excel?
>
> Thank you very much.
>
> Regards,
>
> Percy
>
>
> <Sample_data.txt>______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.