[R] detecting autocorrelation structure in panel data

Liviu Andronic landronimirc at gmail.com
Mon Nov 28 09:44:43 CET 2011


On Mon, Nov 28, 2011 at 3:54 AM, Matteo Richiardi
<matteo.richiardi at gmail.com> wrote:
> Hello,
> I'm a newby in R. I have created a data.frame holding panel data, with
>
Take a look at the 'plm' package and its vignette.

Regards
Liviu


> the following columns: "id","time","y", say:
>
> periods = 100
> numcases = 100
> df = data.frame(
>  id = rep(1:numcases,periods),
>  time = rep(1:periods, each = numcases)
> )
> df = transform(df,y=c(rnorm(numcases*periods)+id)
>
> I want to check whether "y" is autocorrelated. I came across the acf()
> function, but I cannot understand how to specify that my time variable
> is "time" and that individuals are identified by their "id". I have
> also tried to convert my data.frame in a ts or a xts object, but got
> really lost there. I'd really apreciate help...
>
> Thank you,
> Matteo
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
http://goodies.xfce.org/projects/applications/xfce4-dict#speed-reader
Do you know how to write?
http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail



More information about the R-help mailing list