require help

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

require help

yadav neog
hello to all. I am working on macroeconomic data series of India, which in
a yearly basis. I am unable to convert my data frame into time series.
kindly help me.
also using zoo and xts packages. but they take only monthly observations.

'data.frame': 30 obs. of  4 variables:
 $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
 $ cnsm: num  174 175 175 172 173 ...
 $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
 $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
--
Yadawananda Neog
Research Scholar
Department of Economics
Banaras Hindu University
Mob. 9838545073

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

Eric Berger
You did not provide the data frame so I will first create one and then use
it to create an xts

library(xts)
df <- data.frame( year=1980:2009, cnsm=sample(170:180,30,replace=TRUE),
                  incm=rnorm(30,53,1), wlth=rnorm(30,60,1))
dates <- as.Date(paste(df$year,"-01-01",sep=""))
myXts <- xts(df,order.by=dates)



On Fri, Sep 15, 2017 at 12:38 PM, yadav neog <[hidden email]> wrote:

> hello to all. I am working on macroeconomic data series of India, which in
> a yearly basis. I am unable to convert my data frame into time series.
> kindly help me.
> also using zoo and xts packages. but they take only monthly observations.
>
> 'data.frame': 30 obs. of  4 variables:
>  $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
>  $ cnsm: num  174 175 175 172 173 ...
>  $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
>  $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
> --
> Yadawananda Neog
> Research Scholar
> Department of Economics
> Banaras Hindu University
> Mob. 9838545073
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

Ismail SEZEN
In reply to this post by yadav neog

> On 15 Sep 2017, at 12:38, yadav neog <[hidden email]> wrote:
>
> hello to all. I am working on macroeconomic data series of India, which in
> a yearly basis. I am unable to convert my data frame into time series.


Do you really need to convert your data to time series/xts/zoo? I don’t know you try what kind of an analysis but perhaps you don’t have to.

> kindly help me.
> also using zoo and xts packages. but they take only monthly observations.

If you really have to convert to xts/zoo, why don’t yo set each year to first day of January and use it as is? For instance,

index, cnsm, incm, wlth
1980-01-01, 174, 53.4, 60.3
1981-01-01, 175, 53.7, 60.5
1982-01-01, 175, 53.5, 60.2
…..

>
> 'data.frame': 30 obs. of  4 variables:
> $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
> $ cnsm: num  174 175 175 172 173 ...
> $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
> $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
> --
> Yadawananda Neog
> Research Scholar
> Department of Economics
> Banaras Hindu University
> Mob. 9838545073
>

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

yadav neog
thanks, eric../ actually I have the data which have not specify the months.
therefore i bound to declare is in yearly data. i also attached a sample
data set that may be helpful for you to providing suggestions. thank you

On Fri, Sep 15, 2017 at 5:23 PM, Ismail SEZEN <[hidden email]> wrote:

>
> > On 15 Sep 2017, at 12:38, yadav neog <[hidden email]> wrote:
> >
> > hello to all. I am working on macroeconomic data series of India, which
> in
> > a yearly basis. I am unable to convert my data frame into time series.
>
>
> Do you really need to convert your data to time series/xts/zoo? I don’t
> know you try what kind of an analysis but perhaps you don’t have to.
>
> > kindly help me.
> > also using zoo and xts packages. but they take only monthly observations.
>
> If you really have to convert to xts/zoo, why don’t yo set each year to
> first day of January and use it as is? For instance,
>
> index, cnsm, incm, wlth
> 1980-01-01, 174, 53.4, 60.3
> 1981-01-01, 175, 53.7, 60.5
> 1982-01-01, 175, 53.5, 60.2
> …..
>
> >
> > 'data.frame': 30 obs. of  4 variables:
> > $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
> > $ cnsm: num  174 175 175 172 173 ...
> > $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
> > $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
> > --
> > Yadawananda Neog
> > Research Scholar
> > Department of Economics
> > Banaras Hindu University
> > Mob. 9838545073
> >
>
>


--
Yadawananda Neog
Research Scholar
Department of Economics
Banaras Hindu University
Mob. 9838545073
______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

Berend Hasselman
In reply to this post by yadav neog

> On 15 Sep 2017, at 11:38, yadav neog <[hidden email]> wrote:
>
> hello to all. I am working on macroeconomic data series of India, which in
> a yearly basis. I am unable to convert my data frame into time series.
> kindly help me.
> also using zoo and xts packages. but they take only monthly observations.
>
> 'data.frame': 30 obs. of  4 variables:
> $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
> $ cnsm: num  174 175 175 172 173 ...
> $ incm: num  53.4 53.7 53.5 53.2 53.3 ...


It shouldn't be difficult.
Example:

tsdata <- data.frame(year=c(2000,2002,2003), x=c(1,2,3),y=c(10,11,12))
xy.ts <- as.ts(tsdata)

library(zoo)

as.zoo(xy.ts)


Berend Hasselman

> $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
> --
> Yadawananda Neog
> Research Scholar
> Department of Economics
> Banaras Hindu University
> Mob. 9838545073
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

Berend Hasselman

> On 15 Sep 2017, at 16:35, Berend Hasselman <[hidden email]> wrote:
>
>>
>> On 15 Sep 2017, at 11:38, yadav neog <[hidden email]> wrote:
>>
>> hello to all. I am working on macroeconomic data series of India, which in
>> a yearly basis. I am unable to convert my data frame into time series.
>> kindly help me.
>> also using zoo and xts packages. but they take only monthly observations.
>>
>> 'data.frame': 30 obs. of  4 variables:
>> $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
>> $ cnsm: num  174 175 175 172 173 ...
>> $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
>
>
> It shouldn't be difficult.
> Example:
>
> tsdata <- data.frame(year=c(2000,2002,2003), x=c(1,2,3),y=c(10,11,12))
> xy.ts <- as.ts(tsdata)
>
> library(zoo)
>
> as.zoo(xy.ts)


Ignore my suggestion.  Doesn't do what you need.

Berend

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

Berend Hasselman
In reply to this post by yadav neog

> On 15 Sep 2017, at 11:38, yadav neog <[hidden email]> wrote:
>
> hello to all. I am working on macroeconomic data series of India, which in
> a yearly basis. I am unable to convert my data frame into time series.
> kindly help me.
> also using zoo and xts packages. but they take only monthly observations.
>
> 'data.frame': 30 obs. of  4 variables:
> $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
> $ cnsm: num  174 175 175 172 173 ...
> $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
> $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
> --

Second try to do what you would like (I hope and think)
Using Eric's sample data

<code>
zdf <- data.frame(year=2001:2010, cnsm=sample(170:180,10,replace=TRUE),
                 incm=rnorm(10,53,1), wlth=rnorm(10,60,1))
zdf

# R ts
zts <- ts(zdf[,-1], start=zdf[1,"year"])
zts

# turn data into a zoo timeseries and an xts timeseries

library(zoo)
z.zoo <- as.zoo(zts)
z.zoo

library(xts)
z.xts <- as.xts(zts)
z.xts
</code>

Berend Hasselman

> Yadawananda Neog
> Research Scholar
> Department of Economics
> Banaras Hindu University
> Mob. 9838545073
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

Eric Berger
You can just use the same code that I provided before but now use your
dataset. Like this

df <- read.csv(file="data2.csv",header=TRUE)
dates <- as.Date(paste(df$year,"-01-01",sep=""))
myXts <- xts(df,order.by=dates)
head(myXts)

#The last command "head(myXts)" shows you the first few rows of the xts
object
           year     cnsm    incm    wlth
1980-01-01 1980 173.6527 53.3635 60.3013
1981-01-01 1981 175.4613 53.6929 60.4980
1982-01-01 1982 174.5724 53.4890 60.2358
1983-01-01 1983 171.5070 53.2223 60.1047
1984-01-01 1984 173.3462 53.2851 60.6946
1985-01-01 1985 171.7075 53.1596 60.7598


On Sat, Sep 16, 2017 at 9:55 AM, Berend Hasselman <[hidden email]> wrote:

>
> > On 15 Sep 2017, at 11:38, yadav neog <[hidden email]> wrote:
> >
> > hello to all. I am working on macroeconomic data series of India, which
> in
> > a yearly basis. I am unable to convert my data frame into time series.
> > kindly help me.
> > also using zoo and xts packages. but they take only monthly observations.
> >
> > 'data.frame': 30 obs. of  4 variables:
> > $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
> > $ cnsm: num  174 175 175 172 173 ...
> > $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
> > $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
> > --
>
> Second try to do what you would like (I hope and think)
> Using Eric's sample data
>
> <code>
> zdf <- data.frame(year=2001:2010, cnsm=sample(170:180,10,replace=TRUE),
>                  incm=rnorm(10,53,1), wlth=rnorm(10,60,1))
> zdf
>
> # R ts
> zts <- ts(zdf[,-1], start=zdf[1,"year"])
> zts
>
> # turn data into a zoo timeseries and an xts timeseries
>
> library(zoo)
> z.zoo <- as.zoo(zts)
> z.zoo
>
> library(xts)
> z.xts <- as.xts(zts)
> z.xts
> </code>
>
> Berend Hasselman
>
> > Yadawananda Neog
> > Research Scholar
> > Department of Economics
> > Banaras Hindu University
> > Mob. 9838545073
> >
> >       [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

yadav neog
oky.. thank you very much to all of you


On Sat, Sep 16, 2017 at 2:06 PM, Eric Berger <[hidden email]> wrote:

> You can just use the same code that I provided before but now use your
> dataset. Like this
>
> df <- read.csv(file="data2.csv",header=TRUE)
> dates <- as.Date(paste(df$year,"-01-01",sep=""))
> myXts <- xts(df,order.by=dates)
> head(myXts)
>
> #The last command "head(myXts)" shows you the first few rows of the xts
> object
>            year     cnsm    incm    wlth
> 1980-01-01 1980 173.6527 53.3635 60.3013
> 1981-01-01 1981 175.4613 53.6929 60.4980
> 1982-01-01 1982 174.5724 53.4890 60.2358
> 1983-01-01 1983 171.5070 53.2223 60.1047
> 1984-01-01 1984 173.3462 53.2851 60.6946
> 1985-01-01 1985 171.7075 53.1596 60.7598
>
>
> On Sat, Sep 16, 2017 at 9:55 AM, Berend Hasselman <[hidden email]> wrote:
>
>>
>> > On 15 Sep 2017, at 11:38, yadav neog <[hidden email]> wrote:
>> >
>> > hello to all. I am working on macroeconomic data series of India, which
>> in
>> > a yearly basis. I am unable to convert my data frame into time series.
>> > kindly help me.
>> > also using zoo and xts packages. but they take only monthly
>> observations.
>> >
>> > 'data.frame': 30 obs. of  4 variables:
>> > $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
>> > $ cnsm: num  174 175 175 172 173 ...
>> > $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
>> > $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
>> > --
>>
>> Second try to do what you would like (I hope and think)
>> Using Eric's sample data
>>
>> <code>
>> zdf <- data.frame(year=2001:2010, cnsm=sample(170:180,10,replace=TRUE),
>>                  incm=rnorm(10,53,1), wlth=rnorm(10,60,1))
>> zdf
>>
>> # R ts
>> zts <- ts(zdf[,-1], start=zdf[1,"year"])
>> zts
>>
>> # turn data into a zoo timeseries and an xts timeseries
>>
>> library(zoo)
>> z.zoo <- as.zoo(zts)
>> z.zoo
>>
>> library(xts)
>> z.xts <- as.xts(zts)
>> z.xts
>> </code>
>>
>> Berend Hasselman
>>
>> > Yadawananda Neog
>> > Research Scholar
>> > Department of Economics
>> > Banaras Hindu University
>> > Mob. 9838545073
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>> ______________________________________________
>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posti
>> ng-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>


--
Yadawananda Neog
Research Scholar
Department of Economics
Banaras Hindu University
Mob. 9838545073

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

Gabor Grothendieck
Assuming the input data.frame, DF, is of the form  shown reproducibly
in the Note below, to convert the series to zoo or ts:

library(zoo)

# convert to zoo
z <- read.zoo(DF)

# convert to ts
as.ts(z) #


Note:

DF <- structure(list(year = c(1980, 1981, 1982, 1983, 1984), cnsm = c(174,
175, 175, 172, 173), incm = c(53.4, 53.7, 53.5, 53.2, 53.3),
    with = c(60.3, 60.5, 60.2, 60.1, 60.7)), .Names = c("year",
"cnsm", "incm", "with"), row.names = c(NA, -5L), class = "data.frame")


On Sat, Sep 16, 2017 at 8:10 AM, yadav neog <[hidden email]> wrote:

> oky.. thank you very much to all of you
>
>
> On Sat, Sep 16, 2017 at 2:06 PM, Eric Berger <[hidden email]> wrote:
>
>> You can just use the same code that I provided before but now use your
>> dataset. Like this
>>
>> df <- read.csv(file="data2.csv",header=TRUE)
>> dates <- as.Date(paste(df$year,"-01-01",sep=""))
>> myXts <- xts(df,order.by=dates)
>> head(myXts)
>>
>> #The last command "head(myXts)" shows you the first few rows of the xts
>> object
>>            year     cnsm    incm    wlth
>> 1980-01-01 1980 173.6527 53.3635 60.3013
>> 1981-01-01 1981 175.4613 53.6929 60.4980
>> 1982-01-01 1982 174.5724 53.4890 60.2358
>> 1983-01-01 1983 171.5070 53.2223 60.1047
>> 1984-01-01 1984 173.3462 53.2851 60.6946
>> 1985-01-01 1985 171.7075 53.1596 60.7598
>>
>>
>> On Sat, Sep 16, 2017 at 9:55 AM, Berend Hasselman <[hidden email]> wrote:
>>
>>>
>>> > On 15 Sep 2017, at 11:38, yadav neog <[hidden email]> wrote:
>>> >
>>> > hello to all. I am working on macroeconomic data series of India, which
>>> in
>>> > a yearly basis. I am unable to convert my data frame into time series.
>>> > kindly help me.
>>> > also using zoo and xts packages. but they take only monthly
>>> observations.
>>> >
>>> > 'data.frame': 30 obs. of  4 variables:
>>> > $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
>>> > $ cnsm: num  174 175 175 172 173 ...
>>> > $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
>>> > $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
>>> > --
>>>
>>> Second try to do what you would like (I hope and think)
>>> Using Eric's sample data
>>>
>>> <code>
>>> zdf <- data.frame(year=2001:2010, cnsm=sample(170:180,10,replace=TRUE),
>>>                  incm=rnorm(10,53,1), wlth=rnorm(10,60,1))
>>> zdf
>>>
>>> # R ts
>>> zts <- ts(zdf[,-1], start=zdf[1,"year"])
>>> zts
>>>
>>> # turn data into a zoo timeseries and an xts timeseries
>>>
>>> library(zoo)
>>> z.zoo <- as.zoo(zts)
>>> z.zoo
>>>
>>> library(xts)
>>> z.xts <- as.xts(zts)
>>> z.xts
>>> </code>
>>>
>>> Berend Hasselman
>>>
>>> > Yadawananda Neog
>>> > Research Scholar
>>> > Department of Economics
>>> > Banaras Hindu University
>>> > Mob. 9838545073
>>> >
>>> >       [[alternative HTML version deleted]]
>>> >
>>> > ______________________________________________
>>> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> > https://stat.ethz.ch/mailman/listinfo/r-help
>>> > PLEASE do read the posting guide http://www.R-project.org/posti
>>> ng-guide.html
>>> > and provide commented, minimal, self-contained, reproducible code.
>>>
>>> ______________________________________________
>>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> PLEASE do read the posting guide http://www.R-project.org/posti
>>> ng-guide.html
>>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>
>>
>
>
> --
> Yadawananda Neog
> Research Scholar
> Department of Economics
> Banaras Hindu University
> Mob. 9838545073
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.



--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

yadav neog
thankx to everyone for your valuable suggestions. one query regarding the
GARCH model.
I have applied the GARCH model for the same data that I send you all . and
my results coming like

Error in .sgarchfit(spec = spec, data = data, out.sample = out.sample,  :

ugarchfit-->error: function requires at least 100 data
 points to run

can you suggest something on it.

On Fri, Sep 22, 2017 at 6:02 AM, Gabor Grothendieck <[hidden email]
> wrote:

> Assuming the input data.frame, DF, is of the form  shown reproducibly
> in the Note below, to convert the series to zoo or ts:
>
> library(zoo)
>
> # convert to zoo
> z <- read.zoo(DF)
>
> # convert to ts
> as.ts(z) #
>
>
> Note:
>
> DF <- structure(list(year = c(1980, 1981, 1982, 1983, 1984), cnsm = c(174,
> 175, 175, 172, 173), incm = c(53.4, 53.7, 53.5, 53.2, 53.3),
>     with = c(60.3, 60.5, 60.2, 60.1, 60.7)), .Names = c("year",
> "cnsm", "incm", "with"), row.names = c(NA, -5L), class = "data.frame")
>
>
> On Sat, Sep 16, 2017 at 8:10 AM, yadav neog <[hidden email]> wrote:
> > oky.. thank you very much to all of you
> >
> >
> > On Sat, Sep 16, 2017 at 2:06 PM, Eric Berger <[hidden email]>
> wrote:
> >
> >> You can just use the same code that I provided before but now use your
> >> dataset. Like this
> >>
> >> df <- read.csv(file="data2.csv",header=TRUE)
> >> dates <- as.Date(paste(df$year,"-01-01",sep=""))
> >> myXts <- xts(df,order.by=dates)
> >> head(myXts)
> >>
> >> #The last command "head(myXts)" shows you the first few rows of the xts
> >> object
> >>            year     cnsm    incm    wlth
> >> 1980-01-01 1980 173.6527 53.3635 60.3013
> >> 1981-01-01 1981 175.4613 53.6929 60.4980
> >> 1982-01-01 1982 174.5724 53.4890 60.2358
> >> 1983-01-01 1983 171.5070 53.2223 60.1047
> >> 1984-01-01 1984 173.3462 53.2851 60.6946
> >> 1985-01-01 1985 171.7075 53.1596 60.7598
> >>
> >>
> >> On Sat, Sep 16, 2017 at 9:55 AM, Berend Hasselman <[hidden email]>
> wrote:
> >>
> >>>
> >>> > On 15 Sep 2017, at 11:38, yadav neog <[hidden email]> wrote:
> >>> >
> >>> > hello to all. I am working on macroeconomic data series of India,
> which
> >>> in
> >>> > a yearly basis. I am unable to convert my data frame into time
> series.
> >>> > kindly help me.
> >>> > also using zoo and xts packages. but they take only monthly
> >>> observations.
> >>> >
> >>> > 'data.frame': 30 obs. of  4 variables:
> >>> > $ year: int  1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 ...
> >>> > $ cnsm: num  174 175 175 172 173 ...
> >>> > $ incm: num  53.4 53.7 53.5 53.2 53.3 ...
> >>> > $ wlth: num  60.3 60.5 60.2 60.1 60.7 ...
> >>> > --
> >>>
> >>> Second try to do what you would like (I hope and think)
> >>> Using Eric's sample data
> >>>
> >>> <code>
> >>> zdf <- data.frame(year=2001:2010, cnsm=sample(170:180,10,
> replace=TRUE),
> >>>                  incm=rnorm(10,53,1), wlth=rnorm(10,60,1))
> >>> zdf
> >>>
> >>> # R ts
> >>> zts <- ts(zdf[,-1], start=zdf[1,"year"])
> >>> zts
> >>>
> >>> # turn data into a zoo timeseries and an xts timeseries
> >>>
> >>> library(zoo)
> >>> z.zoo <- as.zoo(zts)
> >>> z.zoo
> >>>
> >>> library(xts)
> >>> z.xts <- as.xts(zts)
> >>> z.xts
> >>> </code>
> >>>
> >>> Berend Hasselman
> >>>
> >>> > Yadawananda Neog
> >>> > Research Scholar
> >>> > Department of Economics
> >>> > Banaras Hindu University
> >>> > Mob. 9838545073
> >>> >
> >>> >       [[alternative HTML version deleted]]
> >>> >
> >>> > ______________________________________________
> >>> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>> > https://stat.ethz.ch/mailman/listinfo/r-help
> >>> > PLEASE do read the posting guide http://www.R-project.org/posti
> >>> ng-guide.html
> >>> > and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>> ______________________________________________
> >>> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> >>> https://stat.ethz.ch/mailman/listinfo/r-help
> >>> PLEASE do read the posting guide http://www.R-project.org/posti
> >>> ng-guide.html
> >>> and provide commented, minimal, self-contained, reproducible code.
> >>>
> >>
> >>
> >
> >
> > --
> > Yadawananda Neog
> > Research Scholar
> > Department of Economics
> > Banaras Hindu University
> > Mob. 9838545073
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
>
>
> --
> Statistics & Software Consulting
> GKX Group, GKX Associates Inc.
> tel: 1-877-GKX-GROUP
> email: ggrothendieck at gmail.com
>



--
Yadawananda Neog
Research Scholar
Department of Economics
Banaras Hindu University
Mob. 9838545073

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.
Reply | Threaded
Open this post in threaded view
|

Re: require help

Joshua Ulrich
On Fri, Sep 22, 2017 at 7:28 AM, yadav neog <[hidden email]> wrote:

> thankx to everyone for your valuable suggestions. one query regarding the
> GARCH model.
> I have applied the GARCH model for the same data that I send you all . and
> my results coming like
>
> Error in .sgarchfit(spec = spec, data = data, out.sample = out.sample,  :
>
> ugarchfit-->error: function requires at least 100 data
>  points to run
>
> can you suggest something on it.
>
The error is protecting you from the unreliable results that you would
get by running the model on too few observations.  You either need
more data, or a different algorithm (not GARCH).

>
>
>
> --
> Yadawananda Neog
> Research Scholar
> Department of Economics
> Banaras Hindu University
> Mob. 9838545073
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> 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.



--
Joshua Ulrich  |  about.me/joshuaulrich
FOSS Trading  |  www.fosstrading.com
R/Finance 2017 | www.rinfinance.com

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
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.