options(echo=T)
.Random.seed <- c(57,0,3,0,0,0,49,16,0,0,0,0)
# test simple matrix, vector, ts stuff
if(all(rev(1:10)==10.:1))"Rev and all seem OK"
rep(c("a,","b","c"),0:2)
rep(3.14159,8)
sort(c(3,1,5,2,4))
split(1:10,c("Odd","Even"))
match(1:5,c(3,4,4,2))
rank(c(1,2,3,3,5))
unique(c(1,2,3,3,1,2,5))
xmat_matrix(rnorm(60),20,3)
round(xmat,1)
t(round(xmat,2))
xmat_cbind(rbind(xmat,c(1,1,1)),rnorm(21))
cor(xmat); cor(xmat,trim=.2)
yvec_rnorm(21)
r_regress(xmat,yvec)
regprt(r,names=encode("X Variable",1:4))
regsum(r)
sum(abs(yvec-r$resid-cbind(1,xmat)%*%r$coef))	# should be near zero
twoway(xmat)->tt	# should get warning
fit_matrix(tt$row,nrow(xmat),ncol(xmat))+matrix(tt$col,nrow(xmat),ncol(xmat),byrow=TRUE)+
tt$grand
sum(abs(fit+tt$resid-xmat))
timeser_ts(1:20,c(1958,3),12)
start(timeser);end(timeser);frequency(timeser);nper(timeser)
print(cbind(time(timeser),cycle(timeser),timeser%m%INT))
mm_matrix(runif(16),4,4)
if(any(diag(mm)!=mm[row(mm)==col(mm)]))"We got troubles"
diag(3);diag(diag(mm))
mm[1,3]_NA
replace(mm,3,10000000)
append(mm,1:5)	#should end in 1:5 and be a vector, not matrix
pmin(c(1,3,9),c(2,2,20))
pmax(c(1,3,9),c(2,2,20))
min(smooth(1:20)==1:20)	# should be 1
c(229,205,228,233,224,244,229,215,236,293,323,286,
356,158,104,108,108,130,115,154,84,67,43,86,
15,0,0,7,0,2,61,38,166,59,88,111,
114,86,48,95,93,34,139,136,167,23,111)->deposits	# suspended bank deposits
deposits_ts(deposits,start=1921,frequency=1)
smooth(deposits)
range(rnorm(1000))
ifelse(runif(10)>.5,"heads","tails")
na(print(c(1,3,NA,4,3/0)))
len(xmat);mode(xmat)
prod(1:10)==3628800
l_order(xmat[,1])
ttt_xmat[l,]
dimnames(ttt)_list((1:nrow(xmat))%m%CHAR,NULL)
ttt
dput(xmat,file="tttt"); dget("tttt")
!rm tttt
