Hi,
Now I become a two weeks old for Julia and still struggling with Julia.
I am porting *AR1 function* below from a *cran R* but for some reason it
gives me an error (SingularException(3)) when I convert *solve() to get
Alpha* into *inv()*. However, it works with R and Matlab.
y=float(r,1]) # r is data vector from the attached DJ.csv file
T = length(y)-1;
Y = y[2:T]';
Y1= y[1:(T-1)]';
Alpha= inv(Y1'.*Y).*(Y1').*Y;
*ERROR : SingularException(3)*
As an alternative, I am trying to get AR1 coefficient from *arima() *of the
*TimeModels* package but it's not working either.
using TimeModels
zz=rand(500,1); #500*1 Array(Float64,2)
arima(zz,1,0,0);
*ERROR : 'arima' has no method matching arima (::Array{Float64,2), ::Int64,
::Int64, ::Int64)*
Can someone tell me what is the behind story of the error?
Many thanks and Happy New Year to all!!
AR1 <-function(x){T <- length(x) -1Y <- x[2:T]Y_ <- x[1:(T-1)] ALPHA <-
solve(t(Y_) %*% Y_ ) %*% t(Y_) %*% YRE <- Y - Y_ %*% ALPHASIGMAS <- sum(RE^2)
/ (T-1)STDA <- sqrt( SIGMAS * solve(t(Y_) %*% Y_ ))return(list(ALPHA=ALPHA,
STDA=STDA))} Source : ttps://github.com/cran/vrtest/blob/master/R/AR1.R
-0.009123476
0.012309363
0.001955513
-0.001955513
0.002443794
-0.001710029
-0.003674223
0.015825041
0.001207001
0.008169195
0.011420538
0.012927669
-0.001402197
0.011394147
-0.01092653
-0.00609615
-0.002354604
-0.009474254
-0.002621233
0.00736958
-0.000236883
-0.007848774
0.004288784
0.011817675
-0.004238292
-0.008530857
-0.002144134
-0.015139061
-0.001696353
0.004597709
-0.007512455
-0.013222524
0
-0.007422102
-0.013751936
0.000503398
0.013993232
0
0.000496155
-0.000992556
0.007666663
0.002460631
0.001718846
-0.013585487
0.026504619
0.010120568
-0.000479616
0.004547094
0.00595169
-0.018929522
0.002657327
-0.00338328
0.014181226
-0.006705006
0.004076255
0.003582949
0.002619361
0.005691265
-0.004978083
-0.003571007
-0.010308134
0.00240674
-0.011605546
0.003156492
0.003388193
-0.012887716
-0.006383523
-0.000492732
-0.01264741
-0.013821052
-0.009917437
0.018483879
-0.009832425
0.00757197
0.001005278
0.002007529
-0.003767429
-0.004286982
0.004035314
0.015980365
-0.003971214
0.001987578
-0.008474627
0.011943411
-0.016710702
-0.008841791
-0.008664682
-0.014956442
0.005182701
0.005670118
-0.008776515
-0.002076305
0.001298196
0.017490158
-0.005112486
-0.000256312
-0.001282545
-0.005920985
0.001290156
0.017889565