Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
DSStoffer committed Nov 21, 2024
1 parent 1bafd72 commit 52203bd
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ remotes::install_github("nickpoison/astsa/astsa_build")
- `tsplot` gets a multifigure scale factor so characters do not get too small - examples in the help file.

- `lag1.plot` and `lag2.plot` got little facelifts.
- `lag1.plot` and `lag2.plot` got little facelifts including increasing the character expansion (`cex`) a bit to prevent characters from getting too small.

- in `tsplot`, if `spaghetti=TRUE`, added the ability to include a simple legend (so you don't have to use `legend`). An example is in the help file.

Expand Down
Binary file modified astsa_2.2.tar.gz
Binary file not shown.
5 changes: 3 additions & 2 deletions astsa_build/R/lag1.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,16 @@ function(series, max.lag=1, corr=TRUE, smooth=TRUE, col=gray(.1), bg=NA,

series = as.ts(series)
par(mfrow = c(prow, pcol))
if (par('cex') < .9) par(cex =.9)
for(h in 1:max.lag){
u = ts.intersect(stats::lag(series,-h), series)
tsplot(u[,1], u[,2], type='p', xy.labels=FALSE, xy.lines=FALSE, gg=gg,
xlab=paste(name1,h,")",sep=""), ylab=name2, col=col, cex=cex, bg=bg, ...)
xlab=paste(name1,h,")",sep=""), ylab=name2, col=col, cex=cex, bg=bg, ...)
if (smooth)
lines(stats::lowess(u[,1], u[,2]), col=lwc, lwd=lwl)
if (corr) {
legend("topright", legend=format(round(a[h], digits=2), nsmall=2),
text.col=ltcol, bg=bgl, adj=.25, box.col=box.col, cex=.9)
text.col=ltcol, bg=bgl, adj=.25, box.col=box.col, cex=.8)
if (gg) { box(col=gray(1)) } else { box(col=gray(.62)) }
}
on.exit(par(old.par))
Expand Down
3 changes: 2 additions & 1 deletion astsa_build/R/lag2.plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ function(series1, series2, max.lag=0, corr=TRUE, smooth=TRUE, col=gray(.1), bg=N
series1 = as.ts(series1)
series2 = as.ts(series2)
par(mfrow = c(prow,pcol))
if (par('cex') < .9) par(cex =.9)
for(h in 0:max.lag){
u = ts.intersect(stats::lag(series1,-h), series2)
Xlab = ifelse(h==0, name10, paste(name1,h,")",sep=""))
Expand All @@ -31,7 +32,7 @@ function(series1, series2, max.lag=0, corr=TRUE, smooth=TRUE, col=gray(.1), bg=N
lines(stats::lowess(u[,1], u[,2]), col=lwc, lwd=lwl)
if (corr){
legend("topright", legend=format(round(a[m1-h], digits=2),nsmall=2),
text.col=ltcol, bg=bgl, adj=.25, box.col=box.col, cex=.9)
text.col=ltcol, bg=bgl, adj=.25, box.col=box.col, cex=.8)
if (gg) { box(col=gray(1)) } else { box(col=gray(.62)) }
}
on.exit(par(old.par))
Expand Down
5 changes: 3 additions & 2 deletions astsa_build/R/sarima.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ function(xdata,p,d,q,P=0,D=0,Q=0,S=-1,details=TRUE,xreg=NULL,Model=TRUE,
if(details){
old.par <- par(no.readonly = TRUE)
layout(matrix(c(1,2,4, 1,3,4), ncol=2))
par(cex=.85)
rs <- fitit$residuals
stdres <- rs/sqrt(fitit$sigma2)
num <- sum(!is.na(rs))
tsplot(stdres, main = "Standardized Residuals", ylab = "", ...)
if(Model){
if (S<0) {title(bquote('Model: ('~.(p)*','*.(d)*','*.(q)~')'), adj=0) }
if (S<0) {title(bquote('Model: ('~.(p)*','*.(d)*','*.(q)~')'), adj=0, cex.main=.95) }
else {title(bquote('Model: ('~.(p)*','*.(d)*','*.(q)~')'~'\u00D7'~'('~.(P)*','*.(D)*','*.(Q)~')'[~.(S)]),
adj=0) }
adj=0, cex.main=.95) }
}

acf1(rs, max.lag=NULL, main = "ACF of Residuals", ...)
Expand Down
2 changes: 1 addition & 1 deletion astsa_build/man/tsplot.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ par(mfrow=c(3,1), cex=.9) # so fix it
tsplot(cmort); tsplot(tempr); tsplot(part)

# it's rescaled here for your pleasure
tsplot(cbind(big=rnorm(100), bad=rnorm(100), john=rnorm(100)))
tsplot(cbind(big=rnorm(100), bad=rnorm(100), john=rnorm(100))) # default scale=1
tsplot(cbind(big=rnorm(100), bad=rnorm(100), john=rnorm(100)), scale=1.5) # big
}
}
Expand Down

0 comments on commit 52203bd

Please sign in to comment.