# nlar: Estimate non-linear autoregressive coefficients In synlik: Synthetic Likelihood methods for intractable likelihoods.

## Description

Function that, give time series data, transforms them into summary statistics using polynomial autoregression.

## Usage

 `1` ``` nlar(x, lag, power) ```

## Arguments

 `x` a matrix. Each column contains a replicate series. `lag` vector of lags, for rhs terms. `power` vector of powers, for rhs terms.

## Value

a matrix where each column contains the coefficients for a different replicate.

## Author(s)

Simon N. Wood, maintainer Matteo Fasiolo <[email protected]>.

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30``` ```library(synlik) set.seed(10) x <- matrix(runif(200),100,2) beta <- nlar(x,lag=c(1,1),power=c(1,2)) y <- x[,1] y <- y - mean(y) z <- y[1:99];y <- y[2:100] lm(y~z+I(z^2)-1) beta ## NA testing x[5,1] <- x[45,2] <- NA beta <- nlar(x,lag=c(1,1),power=c(1,2)) y <- x[,1] y <- y - mean(y,na.rm=TRUE) z <- y[1:99];y <- y[2:100] lm(y~z+I(z^2)-1) beta ## higher order... set.seed(10) x <- matrix(runif(100),100,2) beta <- nlar(x,lag=c(6,6,6,1,1),power=c(1,2,3,1,2)) k <- 2 y <- x[,k] y <- y - mean(y) ind <- (1+6):100 y6 <- y[ind-6];y1 <- y[ind-1];y <- y[ind] beta0 <- coef(lm(y~y6+I(y6^2)+I(y6^3)+y1+I(y1^2)-1)) as.numeric(beta[,k]);beta0;beta0-as.numeric(beta[,k]) ```

synlik documentation built on May 29, 2017, 12:16 p.m.