﻿

asp.net pdf viewer : Change page size pdf application Library tool html .net winforms online jl-quant-econ38-part884

3.9. ESTIMATIONOFSPECTRA
381
The most t common estimator of the spectral l density of f this process s is the periodogram of
X
0
,...,X
1
,whichisdeﬁnedas
I(w):=
1
n
1
å
t=0
X
t
e
itw
2
,
w2R
(3.99)
(Recallthatjzjdenotesthemodulusofcomplexnumberz)
Alternatively,I(w)canbeexpressedas
I(w)=
1
n
8
<
:
"
1
å
t=0
X
t
cos(wt)
#
2
+
"
1
å
t=0
X
t
sin(wt)
#
2
9
=
;
ItisstraightforwardtoshowthatthefunctionIisevenand2p-periodic(i.e.,I(w)=Iw)and
I(w+2p)=I(w)forallw2R)
Fromthesetworesults,youwillbeabletoverifythatthevaluesofIon[0,p]determinethevalues
ofIonallofR
Thenextsectionhelpstoexplaintheconnectionbetweentheperiodogramandthespectraldensity
Interpretation Tointerprettheperiodogram,itisconvenienttofocusonitsvaluesattheFourier
frequencies
w
j
:=
2pj
n
j=0,...,1
InwhatsenseisI(w
j
)anestimateoff(w
j
)?
Withabitofeffortonecanshowthat,foranyintegerj>0,
1
å
t=0
e
itw
j
=
1
å
t=0
exp
i2pj
t
n
=0
Letting
¯
Xdenotethesamplemeann
1
å
1
t=0
X
t
,wethenhave
nI(w
j
)=
1
å
t=0
(X
t
¯
X)e
itw
j
2
=
1
å
t=0
(X
t
¯
X)e
itw
j
1
å
r=0
(X
r
¯
X)e
irw
j
Bycarefullyworkingthroughthesums,onecantransformthisto
nI(w
j
)=
1
å
t=0
(X
t
¯
X)
2
+2
1
å
k=1
1
å
t=k
(X
t
¯
X)(X
t k
¯
X)cos(w
j
k)
Nowlet
ˆ
g(k):=
1
n
1
å
t=k
(X
t
¯
X)(X
t k
¯
X),
k=0,1,...,1
Thisisthesampleautocovariancefunction,thenatural“plug-inestimator”oftheautocovariance
functiong
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
Change page size pdf - Compress reduce PDF size in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
C# Code & .NET API to Compress & Decompress PDF Document
pdf file size; pdf file compression
Change page size pdf - VB.NET PDF File Compress Library: Compress reduce PDF size in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Compression and Decompression Control SDK
can pdf files be compressed; adjust pdf page size
3.9. ESTIMATIONOFSPECTRA
382
(“Plug-inestimator”isaninformaltermforanestimatorfoundbyreplacingexpectationswith
samplemeans)
Withthisnotation,wecannowwrite
I(w
j
)= ˆg(0)+2
1
å
k=1
ˆ
g(k)cos(w
j
k)
Recallingourexpressionfor fgivenabove,weseethatI(w
j
)isjustasampleanalogoff(w
j
)
Calculation Let’snowconsiderhowtocomputetheperiodogramasdeﬁnedin(3.99)
DSP.jlpackage
However,itisverysimpletoreplicatetheirresults,andthiswillgiveusaplatformtomakeuseful
extensions
ThemostcommonwaytocalculatetheperiodogramisviathediscreteFouriertransform,which
inturnisimplementedthroughthefastFouriertransformalgorithm
Ingeneral,givenasequencea
0
,...,a
1
,thediscreteFouriertransformcomputesthesequence
A
j
:=
1
å
t=0
a
t
exp
i2p
tj
n
,
j=0,...,1
Witha
0
,...,a
1
storedinJuliaarraya,thefunctioncallfft(a)returnsthevaluesA
0
,...,A
1
asaJuliaarray
Itfollowsthat,whenthedataX
0
,...,X
1
isstoredinarrayX,thevaluesI(w
j
)attheFourier
frequencies,whicharegivenby
1
n
1
å
t=0
X
t
exp
i2p
tj
n
2
,
j=0,...,1
canbecomputedbyabs(fft(X)).^2 / length(X)
Note:TheJuliafunctionabsactselementwise,andcorrectlyhandlescomplexnumbers(bycom-
putingtheirmodulus,whichisexactlywhatweneed)
Here’safunctionthatputsallthistogether
function periodogram(x::Array):
length(x)
I_w abs(fft(x)).^n
2pi [0:n-1./ n
# Fourier frequencies
w, I_w w[1:int(n/2)], I_w[1:int(n/2)] # Truncate to interval [0, pi]
return w, I_w
end
Let’sgeneratesomedataforthisfunctionusingtheARMAtypefromQuantEcon
(Seethelectureonlinearprocessesfordetailsonthisclass)
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
VB.NET Image: How to Create Visual Basic .NET Windows Image Viewer
can get a basic idea of the page layout from Apart from that, you are entitled to change the orientation You can accurately define the size and location of all
change font size in fillable pdf form; best compression pdf
C# PDF insert text Library: insert text into PDF content in C#.net
Insert formatted text and plain text to PDF page using .NET XDoc.PDF component in C#.NET class. Ability to change text font, color, size and location and
change paper size in pdf; best way to compress pdf files
3.9. ESTIMATIONOFSPECTRA
383
Here’sacodesnippetthat,oncetheprecedingcodehasbeenrun,generatesdatafromtheprocess
X
t
=0.5X
1
+e
t
0.8e
2
(3.100)
wherefe
t
giswhitenoisewithunitvariance,andcomparestheperiodogramtotheactualspectral
density
import PyPlot: plt
import QuantEcon: ARMA
40
# Data size
phi, theta 0.5, [0-0.8]
# AR and MA parameters
lp ARMA(phi, , theta)
simulation(lp, ts_length=n)
fig, ax plt.subplots()
x, y periodogram(X)
ax[:plot](x, y, "b-", lw=2, alpha=0.5, label="periodogram")
x_sd, y_sd spectral_density(lp, two_pi=False, resolution=120)
ax[:plot](x_sd, y_sd, "r-", lw=2, alpha=0.8, label="spectral density")
ax[:legend]()
plt.show()
Runningthisshouldproduceaﬁguresimilartothisone
Thisestimatelooksratherdisappointing,butthedatasizeisonly40,soperhapsit’snotsurprising
thattheestimateispoor
However,ifwetryagainwithn = 1200theoutcomeisnotmuchbetter
Theperiodogramisfartooirregularrelativetotheunderlyingspectraldensity
Thisbringsustoournexttopic
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
C# PDF Convert: How to Convert Word, Excel, PowerPoint, Tiff
Support conversion to PDF from other documents, keeping original document page size. Support rendering image to a PDF document page, no change for image size.
change font size in pdf comment box; can a pdf be compressed
C# PDF Annotate Library: Draw, edit PDF annotation, markups in C#.
Able to edit and change PDF annotation properties such as font users how to add text comments on PDF page using C# text box to PDF and edit font size and color
pdf files optimized; pdf markup text size
3.9. ESTIMATIONOFSPECTRA
384
Smoothing
Therearetworelatedissueshere
Oneisthat,giventhewaythefastFouriertransformisimplemented,thenumberofpointswat
whichI(w)isestimatedincreasesinlinewiththeamountofdata
Inotherwords,althoughwehavemoredata,wearealsousingittoestimatemorevalues
Asecondissueisthatdensitiesofalltypesarefundamentallyhardtoestimatewithoutparame-
tericassumptions
Typically,nonparametricestimationofdensitiesrequiressomedegreeofsmoothing
Thestandardwaythatsmoothingisappliedtoperiodogramsisbytakinglocalaverages
Inotherwords,thevalueI(w
j
I(w
j p
),I(w
j p+1
),...,I(w
j
),...,I(w
j+p
)
Thisweightedaveragecanbewrittenas
I
S
(w
j
):=
p
å
‘= p
w(‘)I(w
j+‘
)
(3.101)
wheretheweightswp),...,w(p)areasequenceof2p+1nonnegativevaluessummingtoone
Ingenerally,largervaluesofpindicatemoresmoothing—moreonthisbelow
Thenextﬁgureshowsthekindofsequencetypicallyused
Notethesmallerweightstowardstheedgesandlargerweightsinthecenter,sothatmoredistant
valuesfromI(w
j
)havelessweightthancloseronesinthesum(3.101)
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
C# PDF Thumbnail Create SDK: Draw thumbnail images for PDF in C#.
public override Bitmap ConvertToImage(Size targetSize). Description: Convert the PDF page to bitmap with specified size. Parameters:
best pdf compression; change font size in pdf form field
C# PDF File Split Library: Split, seperate PDF into multiple files
set as 1, then the two output PDF files will contains the first page and the explain how to split a PDF file into multiple ones by output PDF file size.
best pdf compressor online; change font size in pdf fillable form
3.9. ESTIMATIONOFSPECTRA
385
EstimationwithSmoothing Ournextstepistoprovidecodethatwillnotonlyestimatethe
periodogrambutalsoprovidesmoothingasrequired
Suchfunctionshavebeenwritteninestspec.jlandareavailableviaQuantEcon.jl
Theﬁleestspec.jlareprintedbelow
#=
Functions for working with periodograms of f scalar r data.
@author : Spencer Lyon <spencer.lyon@nyu.edu>
@date : : 2014-08-21
References
----------
http://quant-econ.net/jl/estspec.html
=#
import DSP
"""
Smooth the data in x using convolution with a window of requested size and type.
##### Arguments
- x::Array: An n array y containing the data to smooth
- window_len::Int(7): An odd integer giving g the e length of the window
- window::AbstractString("hanning"): A string giving the window type. Possible values
are flat, hanning, hamming, bartlett, or blackman
##### Returns
- out::Array: The array of smoothed data
"""
function smooth(x::Array, window_len::Int=7, window::AbstractString="hanning")
if length(x) window_len
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
VB.NET PDF File Split Library: Split, seperate PDF into multiple
Separate source PDF document file by defined page range in VB.NET class application. Divide PDF file into multiple files by outputting PDF file size.
change font size pdf; .pdf printing in thumbnail size
Create Thumbnail Winforms | Online Tutorials
change "Width" & "Height" to set your thumbnail size; items in thumbnail; Click "Swap" to change two items Multi-page Tiff Processing; RasterEdge OCR Engine; PDF
change font size pdf comment box; advanced pdf compressor online
3.9. ESTIMATIONOFSPECTRA
386
throw(ArgumentError("Input vector r length h must be >= window length"))
end
if window_len 3
throw(ArgumentError("Window length h must t be at least 3."))
end
if iseven(window_len)
window_len += 1
println("Window length must be odd, reset to \$window_len")
end
windows Dict("hanning" => DSP.hanning,
"hamming" => DSP.hamming,
"bartlett" => DSP.bartlett,
"blackman" => DSP.blackman,
"flat" => DSP.rect # moving average
)
# Reflect x x around d x[0] and x[-1] prior to convolution
round(Int, window_len 2)
xb x[1:k]
# First k elements
xt x[end-k+1:end# Last k elements
[reverse(xb); x; reverse(xt)]
# === Select window values === #
msg "Unrecognized window type '\$window'"
print(msg " Defaulting to hanning")
window "hanning"
end
windows[window](window_len)
return conv(w ./ sum(w), s)[window_len+1:end-window_len]
end
"Version of smooth where window_len and window are keyword arguments"
function smooth(x::Array; window_len::Int=7, window::AbstractString="hanning")
smooth(x, window_len, window)
end
function periodogram(x::Vector)
length(x)
I_w abs(fft(x)).^./ n
2pi (0:n-1./ # Fourier frequencies
# int rounds to nearest integer. We want to round up or take 1/2 2 + + 1 to
# make sure e we e get the whole interval l from m [0, pi]
ind iseven(n) round(Int, n 1) : ceil(Int, n 2)
w, I_w w[1:ind], I_w[1:ind]
return w, I_w
end
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
3.9. ESTIMATIONOFSPECTRA
387
function periodogram(x::Vector, window::AbstractString, window_len::Int=7)
w, I_w periodogram(x)
I_w smooth(I_w, window_len=window_len, window=window)
return w, I_w
end
"""
Computes the periodogram
I(w) = (1 / / n) ) | sum_{t=0}^{n-1} x_t e^{itw} |^2
at the Fourier r frequences s w_j := 2 pi j / / n, , j = 0, ..., n - 1, using g the e fast
Fourier transform. . Only y the frequences s w_j j in [0, pi] and corresponding values
I(w_j) are returned. . If f a window type is s given n then smoothing is performed.
##### Arguments
- x::Array: An n array y containing the data to smooth
- window_len::Int(7): An odd integer giving g the e length of the window
- window::AbstractString("hanning"): A string giving the window type. Possible values
are flat, hanning, hamming, bartlett, or blackman
##### Returns
- w::Array{Float64}: Fourier frequencies at t which h the periodogram is evaluated
- I_w::Array{Float64}: The periodogram at frequences w
"""
periodogram
"""
Compute periodogram from data x, using prewhitening, smoothing and recoloring.
The data is fitted to an AR(1) model for r prewhitening, , and the residuals are
used to compute a first-pass periodogram m with h smoothing. . The e fitted
coefficients are then used for recoloring.
##### Arguments
- x::Array: An n array y containing the data to smooth
- window_len::Int(7): An odd integer giving g the e length of the window
- window::AbstractString("hanning"): A string giving the window type. Possible values
are flat, hanning, hamming, bartlett, or blackman
##### Returns
- w::Array{Float64}: Fourier frequencies at t which h the periodogram is evaluated
- I_w::Array{Float64}: The periodogram at frequences w
"""
function ar_periodogram(x::Array, window::AbstractString="hanning", window_len::Int=7)
# run regression
x_current, x_lagged x[2:end], x[1:end-1# x_t t and d x_{t-1}
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
3.9. ESTIMATIONOFSPECTRA
388
coefs linreg(x_lagged, x_current)
# get estimated values and compute residual
est [ones(x_lagged) x_lagged] coefs
e_hat x_current est
phi coefs[2]
# compute periodogram on residuals
w, I_w periodogram(e_hat, window, window_len)
# recolor and return
I_w I_w ./ abs(phi .* exp(im.*w)).^2
return w, I_w
end
Thelistingdisplaysthreefunctions,smooth(),periodogram(),ar_periodogram(). Wewilldis-
cusstheﬁrsttwohereandthethirdonebelow
Theperiodogram()functionreturnsaperiodogram,optionallysmoothedviathesmooth()func-
tion
haveappliedafairlytersearray-centricmethodbasedaroundconv
Thenextthreeﬁgureseachshowsmoothedandunsmoothedperiodograms,aswellasthetrue
spectraldensity
(Themodelisthesameasbefore—seeequation(3.100)—andthereare400observations)
Fromtopﬁguretobottom,thewindowlengthisvariedfromsmalltolarge
Inlookingattheﬁgure,wecanseethatforthismodelanddatasize,thewindowlengthchosenin
themiddleﬁgureprovidesthebestﬁt
Relativetothisvalue,theﬁrstwindowlengthprovidesinsufﬁcientsmoothing,whilethethird
givestoomuchsmoothing
Ofcourseinrealestimationproblemsthetruespectraldensityisnot visibleandthechoiceof
Pre-FilteringandSmoothing Inthecodelistingaboveweshowedthreefunctionsfromtheﬁle
estspec.jl
The third function intheﬁle(ar_periodogram())adds apre-processingstep p to o periodogram
smoothing
Firstwedescribethebasicidea,andafterthatwegivethecode
Theessentialideaisto
1. Transformthedatainordertomakeestimationofthespectraldensitymoreefﬁcient
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016