#First Example: Fit to AR(4)
set.seed(3323)
phi<-c(2.7607,-3.8106,2.6535,-0.9238)
z<-SimulateGaussianAR(phi,1000)
#MLE using arima
ans1<-FitARp(z,4,MLEQ=TRUE)
ans1
coef(ans1)
#OLS
ans2<-FitARp(z,4,MLEQ=FALSE)
ans2
coef(ans2)
## Not run: #save time building package
# #Second Example: Fit subset ARp model
# z<-log(lynx)
# #MLE
# FitARp(z, c(1,2,4,7,10,11),MLEQ=TRUE)
# #LS
# FitARp(z, c(1,2,4,7,10,11),MLEQ=FALSE)
#
# #Third Example: Use UBIC model selection to fit subset models
# z<-log(lynx)
# p<-SelectModel(z,ARModel="ARp")[[1]]$p
# #MLE #error returned by arima
# #ans1<-FitARp(z, p, MLEQ=TRUE)
# #ans1
# #LS
# ans2<-FitARp(z, p, MLEQ=FALSE)
# ans2
# ## End(Not run)
Run the code above in your browser using DataLab