I realized that I may not have answered the question you were asking and that
no one else has responded. I can across a similar problem and may have an
answer to your question now. If you have both the wavelet coefficients and the
scaling coefficients then create a fake sequence of the same length as the
original and decompose that sequence using wd form wavethersh with the same
wavelet family and filter that was used to decompose the data. Then you can
replace the wavelet coefficients and the scaling coefficients using putC and
putD from wavethresh. This will leave you with a wd object that you can then
reconstruct using wr from wavethresh. I hope this works and is still useful to
you.
Elizabeth Lawson
Elizabeth Lawson <[EMAIL PROTECTED]> wrote:
Date: Wed, 19 Oct 2005 08:04:02 -0700 (PDT)
From: Elizabeth Lawson <[EMAIL PROTECTED]>
Subject: Re: [R] Wavelet reconstruction
To: Amir Safari <[EMAIL PROTECTED]>
Using wavethresh you can recompose a decompose signal using wr.
Here is an example of decomposing, thresholding and recomposing a signal.
library(wavethresh)
brain<-c(0,0,0.5,1,-0.75,-0.25,1.833333333,-3,0.416666667,1.083333333,-1.833333333,
-0.583333333,2.166666667,-4.083333333,5.75,9.75,1.583333333,0.75,15.83333333,
16.66666667,7.666666667,8.166666667,1.333333333,-3.333333333,-2.75,-2.083333333,
-1.75,0.416666667,1.25,8.583333333,-4.583333333,0.666666667,-6.416666667,3.583333333,
3.416666667,-3.333333333,-7.25,-1.833333333,-1.5,-0.083333333,-2.333333333,7.75,5,
-2.333333333,12,10.5,-1.333333333,-3.333333333,-3.416666667,14.08333333,5.166666667,
5.166666667,2.25,-0.083333333,-1.25,-1,0.083333333,1.666666667,1,-1.333333333,0.416666667,
-0.166666667,-0.25,-0.166666667)
x<-(
c(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,26,
27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,
52,53,54,55,56,57,58,59,60,61,62,63,64))
x<-x/64
par(mfrow=c(1,1))
plot(x,brain,xlab="Voxel",ylab="Activity",main="fMRI Data")
wdbrain<-wd(brain,4,family="DaubExPhase", bc="periodic")
thres2<-threshold(wdbrain,levels=3:(wdbrain$nlevels-1), type="soft",
policy="manual", by.level=FALSE, value=7.32032, dev=var, boundary=FALSE,
verbose = getOption("verbose"), return.threshold=F)
thr2 <- wr(thres2)
plot(x,brain, col = "slateblue",xlab="Voxel",ylab="Activity",main="Wavelet
Regression")
mtext("N=4, Threshold=7.32032")
lines(x, thr2, col= "violetred" , lwd=2,type="l")
Good Luck!!
Elizabeth Lawson
Amir Safari <[EMAIL PROTECTED]> wrote:
Hi There, I tried to find a function in {waveslim} or {wavethresh} in order
to reconstruct the decomposed signals. As far as I found there is no function
in {waveslim} to reconstruct decomposed data. The function wr{wavethresh}
reconstructs the results of wd function. Apart from its limitations ( for
example the length of vector must be power of 2 ) it apparently doesn't work
with the functions and objects in waveslim.
What could help ?
So many thanks for your any idea.
Amir Safari
---------------------------------
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
---------------------------------
---------------------------------
[[alternative HTML version deleted]]
______________________________________________
[email protected] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html