Re: [R] Reg: Help regarding ggplot2

2023-05-02 Thread Upananda Pani
Hi Chrish,

I am grateful to you for your reply. Your code is working fine.
Moreover, you have guided me how to improve my knowledge, I appreciate
it. I will be very careful next time.
The data which i am working on is given below:

dput(head(data_vol3))
structure(list(index = structure(c(12786, 12787, 12788, 12789,
12790, 12793), tzone = "UTC", tclass = "Date", class = "Date"),
crepub = c(1.20601312, 1.176601845, 1.14945752, 1.112667506,
1.076184043, 1.042147848), finland = c(0.614973309, 0.615008409,
0.615034446, 0.615053761, 0.615068089, 0.615078717), france = c(1.896830857,
1.849908737, 1.807150091, 1.763296422, 1.719573044, 1.690600819
), germany = c(3.01041925, 2.892518667, 2.780918603, 2.672356826,
2.567306135, 2.479892045), italy = c(0.345659867, 0.345675874,
0.345686934, 0.345694578, 0.34569986, 0.34570351), netherlands =
c(0.509263785,
0.509279495, 0.509289967, 0.509296947, 0.509301605, 0.509304705
), norway = c(1.052509528, 0.889357215, 0.784607722, 0.710551664,
0.661473027, 0.629951323), poland = c(1.127163733, 1.12432629,
1.087704091, 1.056705592, 1.024417693, 1.007962456), slovakia =
c(0.715652234,
0.706087191, 0.706077173, 0.706104559, 0.70622666, 0.706098981
), slovenia = c(0.831886154, 0.831945994, 0.832003445, 0.832058602,
0.832111556, 0.832162397), uk = c(1.504813191, 1.463648326,
1.424235397, 1.38618692, 1.349628127, 1.318653737), usa = c(1.521675109,
1.488286869, 1.451778376, 1.418378195, 1.384742397, 1.363477506
)), row.names = c(NA, -6L), class = c("tbl_df", "tbl", "data.frame"
))

As there are some countries which are having higher volatilities than
countries with lower, is there any suggestion to improve the graph?

Looking forward to your suggestion in this regard.

With sincere regards,
Upananda Pani


On Tue, May 2, 2023 at 6:14 PM Chris Evans  wrote:
>
> I suspect that you have tried to pass your own data into the pivot_longer() 
> function and your data probably doesn't have the rowN variable.
>
> First try running the whole of what I sent you.  It definitively works for 
> me.  It gives me the attached graph.
>
> My code, using tribble() to read in the data you sent us, creates a rowN 
> variable to save me the trouble of deleting those row numbers one by one.  
> Then I drop that variable with that select(-rowN) line.
>
> Assuming that works for you running my code on that tiny dataset, and that 
> you are trying to use the code on your full data frame, called data_vol3 then 
> try this:
>
> data_vol3 %>%
>   # select(-rowN) %>% # I have commented out this line
>   pivot_longer(cols = -index, # as you want to pivot the other 
> variables/columns
>names_to = "countries") -> tibDataVol3Long
>
> ggplot(data = tibDataVol3Long,
>aes(x = index, y = value, group = countries, colour = countries)) +
>   geom_line()
>
> This is a very good illustration of why you should supply data using 
> dput(data), dput(head(data)) if you have a large dataset. I know it doesn't 
> feel a very sympathetic piece of advice, but I think you need to spend some 
> days working on your understanding of R, ggplot and the tidyverse realm of R. 
>  You can use ggplot() without using much of the tidyverse but they are 
> designed to complement each other and the more I understand of the tidyverse 
> way of doing things, the better I use ggplot().
>
> On 02/05/2023 13:44, Upananda Pani wrote:
>
> Hi Chris,
>
> Thank for your solutions and time. I am getting the following error
> while trying to execute the code you suggested.
>
> Error in select(., -rowN) : unused argument (-rowN)
>
> Regards,
> Upananda
>
> On Tue, May 2, 2023 at 3:08 PM Chris Evans via R-help
>  wrote:
>
> It's not clear what you want but ...
>
> On 02/05/2023 10:57, Upananda Pani wrote:
>
> Dear All,
>
> I have a dataset which contains date and 12 other countries data. I
> have extracted the data as xts object.
>
> I am not able to recall all the series in the Y axis. My data set
> looks like this
>
> index crepub finland france germany italy netherlands norway poland
> 
> 1 2005-01-03 1.21 0.615 1.90 3.01 0.346 0.509 1.05 1.13
> 2 2005-01-04 1.18 0.615 1.85 2.89 0.346 0.509 0.889 1.12
> 3 2005-01-05 1.15 0.615 1.81 2.78 0.346 0.509 0.785 1.09
> 4 2005-01-06 1.11 0.615 1.76 2.67 0.346 0.509 0.711 1.06
> 5 2005-01-07 1.08 0.615 1.72 2.57 0.346 0.509 0.661 1.02
> 6 2005-01-10 1.04 0.615 1.69 2.48 0.346 0.509 0.630 1.01
>
> My code for the same is as follows
>
> ggplot(data=data_vol3, aes(x=index, y=data_vol3$usa)+
> geom_line())
>
> Well you don't need to say that the y data are from data_vol3, your data
> = declaration says that.
>
>

Re: [R] Reg: Help regarding ggplot2

2023-05-02 Thread Upananda Pani
Hi Chris,

Thank for your solutions and time. I am getting the following error
while trying to execute the code you suggested.

Error in select(., -rowN) : unused argument (-rowN)

Regards,
Upananda

On Tue, May 2, 2023 at 3:08 PM Chris Evans via R-help
 wrote:
>
> It's not clear what you want but ...
>
> On 02/05/2023 10:57, Upananda Pani wrote:
> > Dear All,
> >
> > I have a dataset which contains date and 12 other countries data. I
> > have extracted the data as xts object.
> >
> > I am not able to recall all the series in the Y axis. My data set
> > looks like this
> >
> > index crepub finland france germany italy netherlands norway poland
> > 
> > 1 2005-01-03 1.21 0.615 1.90 3.01 0.346 0.509 1.05 1.13
> > 2 2005-01-04 1.18 0.615 1.85 2.89 0.346 0.509 0.889 1.12
> > 3 2005-01-05 1.15 0.615 1.81 2.78 0.346 0.509 0.785 1.09
> > 4 2005-01-06 1.11 0.615 1.76 2.67 0.346 0.509 0.711 1.06
> > 5 2005-01-07 1.08 0.615 1.72 2.57 0.346 0.509 0.661 1.02
> > 6 2005-01-10 1.04 0.615 1.69 2.48 0.346 0.509 0.630 1.01
> >
> > My code for the same is as follows
> >
> > ggplot(data=data_vol3, aes(x=index, y=data_vol3$usa)+
> > geom_line())
>
> Well you don't need to say that the y data are from data_vol3, your data
> = declaration says that.
>
> I wonder if what you want is:
>
> library(tidyverse)
>
> tribble(
>~rowN, ~index, ~crepub, ~finland, ~france, ~germany, ~italy,
> ~netherlands, ~norway, ~poland,
>1, "2005-01-03", 1.21, 0.615, 1.90, 3.01, 0.346, 0.509, 1.05, 1.13,
>2, "2005-01-04", 1.18, 0.615, 1.85, 2.89, 0.346, 0.509, 0.889, 1.12,
>3, "2005-01-05", 1.15, 0.615, 1.81, 2.78, 0.346, 0.509, 0.785, 1.09,
>4, "2005-01-06", 1.11, 0.615, 1.76, 2.67, 0.346, 0.509, 0.711, 1.06,
>5, "2005-01-07", 1.08, 0.615, 1.72, 2.57, 0.346, 0.509, 0.661, 1.02,
>6, "2005-01-10", 1.04, 0.615, 1.69, 2.48, 0.346, 0.509, 0.630, 1.01)
> -> data_vol3
>
> ### please give us data using dput in future: saves us having to do
> something like that to reclaim it!
>
> ### pivot that longer to make it easy to get country data as separate lines
>
> data_vol3 %>%  select(-rowN) %>%
>pivot_longer(cols = -index, # as you want to pivot the other
> variables/columns
> names_to = "countries") -> tibDataVol3Long
>
> ggplot(data = tibDataVol3Long,
> aes(x = index, y = value,
>   ### now get the grouping and use it for a colour legend
>   group = countries, colour = countries)) +
>geom_line()
>
> > Any help in this regard will be highly appreciated
> >
> > With regards,
> > Upananda Pani
> >
> > __
> > R-help@r-project.org 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.
> --
> Chris Evans (he/him)
> Visiting Professor, UDLA, Quito, Ecuador & Honorary Professor,
> University of Roehampton, London, UK.
> Work web site: https://www.psyctc.org/psyctc/
> CORE site: http://www.coresystemtrust.org.uk/
> Personal site: https://www.psyctc.org/pelerinage2016/
> Emeetings (Thursdays):
> <https://www.psyctc.org/pelerinage2016/>https://www.psyctc.org/psyctc/booking-meetings-with-me/
> (Beware: French time, generally an hour ahead of UK)
> <https://ombook.psyctc.org/book>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org 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.

__
R-help@r-project.org 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.


Re: [R] Reg: Help regarding ggplot2

2023-05-02 Thread Upananda Pani
Hi Thomas,

Thanks for your help. I need to plot all other countries as well.

Thanks for your time

With sincere regards,
Upananda

On Tue, May 2, 2023 at 3:01 PM Thomas.Rose 
wrote:

> Dear Upananda,
>
> I see a misplaced bracket in your code, and there is no need in aes() to
> call the dataframe explicitly. Does this work?
>
> ggplot(data = data_vol3, aes(x = index, y = usa)) +
>   geom_line()
>
> Best wishes,
> Thomas
>
> ------
> *Von:* R-help  im Auftrag von Upananda Pani
> 
> *Gesendet:* Dienstag, 2. Mai 2023 10:57
> *An:* r-help 
> *Betreff:* [R] Reg: Help regarding ggplot2
>
> Dear All,
>
> I have a dataset which contains date and 12 other countries data. I
> have extracted the data as xts object.
>
> I am not able to recall all the series in the Y axis. My data set
> looks like this
>
> index  crepub finland france germany italy netherlands norway poland
> 
> 1 2005-01-03   1.21   0.615   1.903.01 0.346   0.509  1.051.13
> 2 2005-01-04   1.18   0.615   1.852.89 0.346   0.509  0.889   1.12
> 3 2005-01-05   1.15   0.615   1.812.78 0.346   0.509  0.785   1.09
> 4 2005-01-06   1.11   0.615   1.762.67 0.346   0.509  0.711   1.06
> 5 2005-01-07   1.08   0.615   1.722.57 0.346   0.509  0.661   1.02
> 6 2005-01-10   1.04   0.615   1.692.48 0.346   0.509  0.630   1.01
>
> My code for the same is as follows
>
> ggplot(data=data_vol3, aes(x=index, y=data_vol3$usa)+
>   geom_line())
>
> Any help in this regard will be highly appreciated
>
> With regards,
> Upananda Pani
>
> __
> R-help@r-project.org 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]]

__
R-help@r-project.org 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.


[R] Reg: Help regarding ggplot2

2023-05-02 Thread Upananda Pani
Dear All,

I have a dataset which contains date and 12 other countries data. I
have extracted the data as xts object.

I am not able to recall all the series in the Y axis. My data set
looks like this

index  crepub finland france germany italy netherlands norway poland

1 2005-01-03   1.21   0.615   1.903.01 0.346   0.509  1.051.13
2 2005-01-04   1.18   0.615   1.852.89 0.346   0.509  0.889   1.12
3 2005-01-05   1.15   0.615   1.812.78 0.346   0.509  0.785   1.09
4 2005-01-06   1.11   0.615   1.762.67 0.346   0.509  0.711   1.06
5 2005-01-07   1.08   0.615   1.722.57 0.346   0.509  0.661   1.02
6 2005-01-10   1.04   0.615   1.692.48 0.346   0.509  0.630   1.01

My code for the same is as follows

ggplot(data=data_vol3, aes(x=index, y=data_vol3$usa)+
  geom_line())

Any help in this regard will be highly appreciated

With regards,
Upananda Pani

__
R-help@r-project.org 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.


Re: [R] Extracting data using subset function

2023-02-06 Thread Upananda Pani
Hi Avi,

Thanks a lot. This worked well.

My sincere gratitude to you for teaching me. I am also grateful to
previous forum contributors, who have given me the various dimensions to
think and solve the problem. It has really helped to enhance my
understanding of subsetting function.

Thank you once again to all of you.

Regards,
Upananda Pani

On Mon, Feb 6, 2023 at 4:29 AM  wrote:

> In reading the post again, it sounds like the question is how to create a
> logical condition that translates as 1:N is TRUE. Someone hinted along
> those lines.
>
> So one WAY I might suggest is you construct a logical vector as shown
> below. I give an example of a bunch of 9 primes and you want only the first
> 5.
>
> > vec <- c(1,2,3,5,7,11,13,17, 19)
> > length(vec)
> [1] 9
> > N <- 5
> > choose <- rep(TRUE, N)
> > choose
> [1] TRUE TRUE TRUE TRUE TRUE
> > subset(vec, choose)# will fail as the remaining are recycled or
> assumed to be true
> [1]  1  2  3  5  7 11 13 17 19
> > tot = length(vec)
> > choose <- c(rep(TRUE, N), rep(FALSE, tot - N))
> > choose
> [1]  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE
> > subset(vec, choose)
> [1] 1 2 3 5 7
>
> The end shows you need to create N Boolean TRUE values and tot-N FALSE to
> make a vector of the same length as the first so everything is indexed.
>
> Does something like this meet your needs?
>
> Realistically, the above technique generalizes to more complex cases
> decently. But sometimes, head(0 and other things I mentioned earlier work
> quite well.
>
>
> -Original Message-
> From: R-help  On Behalf Of Upananda Pani
> Sent: Sunday, February 5, 2023 2:33 PM
> To: Andrés González Carmona 
> Cc: r-help 
> Subject: Re: [R] Extracting data using subset function
>
> Thank you. It means we can not use the subset function here.
>
> Regards
>
> On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona, 
> wrote:
>
> > From ?subset:
> > Warning
> >
> > This is a convenience function intended for use interactively. For
> > programming it is better to use the standard subsetting functions like
> > [ <http://127.0.0.1:21786/library/base/help/%5B>, and in particular
> > the non-standard evaluation of argument subset can have unanticipated
> > consequences.
> >
> > El 05/02/2023 a las 15:07, Upananda Pani escribió:
> >
> > Dear All,
> >
> > I want to create a vector p and extract first 20 observations using
> > subset function based on logical condition.
> >
> > My code is below
> >
> > p <- 0:100
> >
> > I know i can extract the first 20 observations using the following
> command.
> >
> > q <- p[1:20]
> >
> > But I want to extract the first 20 observations using subset function
> > which requires a logical condition. I am not able to frame the logical
> condition.
> >
> > The code should be
> >
> > q <- subset(p, logical condition)
> >
> > I am not able to do it. Please let me know what you think.
> >
> > Best regards,
> > Upananda
> >
> >   [[alternative HTML version deleted]]
> >
> > __r-h...@r-project.org
> > mailing list -- To UNSUBSCRIBE and more,
> > seehttps://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r
> > -help__;!!D9dNQwwGXtA!SLdwTGqSfhwUo4CfbUJFeL7hETw64hOG8MQ0FK_o5YdnvVHa
> > Op9Qxs4D7d5e10hj3YQ8EuaFc8qbnkynoP5dEA$
> > PLEASE do read the posting guide
> > https://urldefense.com/v3/__http://www.R-project.org/posting-guide.htm
> > l__;!!D9dNQwwGXtA!SLdwTGqSfhwUo4CfbUJFeL7hETw64hOG8MQ0FK_o5YdnvVHaOp9Q
> > xs4D7d5e10hj3YQ8EuaFc8qbnkwuss43hA$
> > and provide commented, minimal, self-contained, reproducible code.
> >
> > --
> > * Andrés González Carmona *
> >
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org 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]]

__
R-help@r-project.org 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.


Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
Hi Rolf,

Thank you so much. I was just curious to know that. I am glad that i got
the input from all of you.

I am grateful to you  for clarifying.

With sincere gratitude,
Upananda

On Mon, Feb 6, 2023 at 1:29 AM Rolf Turner  wrote:

> On Sun, 5 Feb 2023 19:37:03 +0530
> Upananda Pani  wrote:
>
> > Dear All,
> >
> > I want to create a vector p and extract first 20 observations using
> > subset function based on logical condition.
> >
> > My code is below
> >
> > p <- 0:100
> >
> > I know i can extract the first 20 observations using the following
> > command.
> >
> > q <- p[1:20]
> >
> > But I want to extract the first 20 observations using subset function
> > which requires a logical condition. I am not able to frame the
> > logical condition.
> >
> > The code should be
> >
> > q <- subset(p, logical condition)
> >
> > I am not able to do it. Please let me know what you think.
>
> I think that you are manufacturing an unnecessary difficulty.  If you
> want the first 20 entries of p, use p[1:20]!!!
>
> However, if you obdurately *insist* on using subset() you could do
>
> subset(p,(1:length(p)) <= 20)
>
> This works, but makes a mountain out of a molehill.
>
> cheers,
>
> Rolf Turner
>
> --
> Honorary Research Fellow
> Department of Statistics
> University of Auckland
> Stats. Dep't. phone: +64-9-373-7599 ext. 89622
> Home phone: +64-9-480-4619
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
Hi Jeff,

Thanks for your reply. What do you exactly mean by "interactively"?  Would
you please give me an example?
Upananda

On Mon, Feb 6, 2023 at 1:27 AM Jeff Newmiller 
wrote:

> No, it means what it says: it is best used interactively rather than in
> functions. That is not saying you cannot use it... merely that you should
> probably use it interactively.
>
> The fact is, though, that integer indexing is much simpler and clearer for
> your particular example than subset is.
>
> q <- p[1:20]
> q2 <- subset( p, 1:100 <= 20) # 1:100 are positions
>
> On February 5, 2023 11:33:16 AM PST, Upananda Pani <
> upananda.p...@gmail.com> wrote:
> >Thank you. It means we can not use the subset function here.
> >
> >Regards
> >
> >On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona, 
> wrote:
> >
> >> From ?subset:
> >> Warning
> >>
> >> This is a convenience function intended for use interactively. For
> >> programming it is better to use the standard subsetting functions like [
> >> <http://127.0.0.1:21786/library/base/help/%5B>, and in particular the
> >> non-standard evaluation of argument subset can have unanticipated
> >> consequences.
> >>
> >> El 05/02/2023 a las 15:07, Upananda Pani escribió:
> >>
> >> Dear All,
> >>
> >> I want to create a vector p and extract first 20 observations using
> subset
> >> function based on logical condition.
> >>
> >> My code is below
> >>
> >> p <- 0:100
> >>
> >> I know i can extract the first 20 observations using the following
> command.
> >>
> >> q <- p[1:20]
> >>
> >> But I want to extract the first 20 observations using subset function
> which
> >> requires a logical condition. I am not able to frame the logical
> condition.
> >>
> >> The code should be
> >>
> >> q <- subset(p, logical condition)
> >>
> >> I am not able to do it. Please let me know what you think.
> >>
> >> Best regards,
> >> Upananda
> >>
> >>  [[alternative HTML version deleted]]
> >>
> >> __r-h...@r-project.org
> mailing list -- To UNSUBSCRIBE and more, seehttps://
> urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-help__;!!D9dNQwwGXtA!SLdwTGqSfhwUo4CfbUJFeL7hETw64hOG8MQ0FK_o5YdnvVHaOp9Qxs4D7d5e10hj3YQ8EuaFc8qbnkynoP5dEA$
> >> PLEASE do read the posting guide
> https://urldefense.com/v3/__http://www.R-project.org/posting-guide.html__;!!D9dNQwwGXtA!SLdwTGqSfhwUo4CfbUJFeL7hETw64hOG8MQ0FK_o5YdnvVHaOp9Qxs4D7d5e10hj3YQ8EuaFc8qbnkwuss43hA$
> >> and provide commented, minimal, self-contained, reproducible code.
> >>
> >> --
> >> * Andrés González Carmona *
> >>
> >
> >   [[alternative HTML version deleted]]
> >
> >__
> >R-help@r-project.org 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.
>
> --
> Sent from my phone. Please excuse my brevity.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
Thank you. It means we can not use the subset function here.

Regards

On Mon, 6 Feb, 2023, 00:53 Andrés González Carmona,  wrote:

> From ?subset:
> Warning
>
> This is a convenience function intended for use interactively. For
> programming it is better to use the standard subsetting functions like [
> <http://127.0.0.1:21786/library/base/help/%5B>, and in particular the
> non-standard evaluation of argument subset can have unanticipated
> consequences.
>
> El 05/02/2023 a las 15:07, Upananda Pani escribió:
>
> Dear All,
>
> I want to create a vector p and extract first 20 observations using subset
> function based on logical condition.
>
> My code is below
>
> p <- 0:100
>
> I know i can extract the first 20 observations using the following command.
>
> q <- p[1:20]
>
> But I want to extract the first 20 observations using subset function which
> requires a logical condition. I am not able to frame the logical condition.
>
> The code should be
>
> q <- subset(p, logical condition)
>
> I am not able to do it. Please let me know what you think.
>
> Best regards,
> Upananda
>
>   [[alternative HTML version deleted]]
>
> __r-h...@r-project.org mailing 
> list -- To UNSUBSCRIBE and more, 
> seehttps://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-help__;!!D9dNQwwGXtA!SLdwTGqSfhwUo4CfbUJFeL7hETw64hOG8MQ0FK_o5YdnvVHaOp9Qxs4D7d5e10hj3YQ8EuaFc8qbnkynoP5dEA$
> PLEASE do read the posting guide 
> https://urldefense.com/v3/__http://www.R-project.org/posting-guide.html__;!!D9dNQwwGXtA!SLdwTGqSfhwUo4CfbUJFeL7hETw64hOG8MQ0FK_o5YdnvVHaOp9Qxs4D7d5e10hj3YQ8EuaFc8qbnkwuss43hA$
> and provide commented, minimal, self-contained, reproducible code.
>
> --
> * Andrés González Carmona *
>

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
How you have defined z1?

On Mon, 6 Feb, 2023, 00:14 粕谷英一,  wrote:

> Do you mean something like the following?  Here the first elements are
> selected by subset function.
>
> > x1
> [1] 9 8 7 6 5 4 3
> > z1
> [1]  TRUE  TRUE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE
> > subset(x1,z1)
> [1] 9 8 7
>
> 2023年2月6日(月) 3:34 Upananda Pani :
> >
> > No i am teaching Econometrics and learning R. I am not a student.
> >
> > Thank you
> > Upananda
> >
> > On Sun, 5 Feb, 2023, 19:51 Chris Ryan via R-help, 
> > wrote:
> >
> > > Is this a homework problem?
> > >
> > > --Chris Ryan
> > > --
> > > Sent from my Android device with K-9 Mail. Please excuse my brevity.
> > >
> > > On February 5, 2023 9:07:03 AM EST, Upananda Pani <
> upananda.p...@gmail.com>
> > > wrote:
> > > >Dear All,
> > > >
> > > >I want to create a vector p and extract first 20 observations using
> subset
> > > >function based on logical condition.
> > > >
> > > >My code is below
> > > >
> > > >p <- 0:100
> > > >
> > > >I know i can extract the first 20 observations using the following
> > > command.
> > > >
> > > >q <- p[1:20]
> > > >
> > > >But I want to extract the first 20 observations using subset function
> > > which
> > > >requires a logical condition. I am not able to frame the logical
> > > condition.
> > > >
> > > >The code should be
> > > >
> > > >q <- subset(p, logical condition)
> > > >
> > > >I am not able to do it. Please let me know what you think.
> > > >
> > > >Best regards,
> > > >Upananda
> > > >
> > > >   [[alternative HTML version deleted]]
> > > >
> > > >__
> > > >R-help@r-project.org 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.
> > >
> > > __
> > > R-help@r-project.org 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]]
> >
> > __
> > R-help@r-project.org 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]]

__
R-help@r-project.org 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.


Re: [R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
No i am teaching Econometrics and learning R. I am not a student.

Thank you
Upananda

On Sun, 5 Feb, 2023, 19:51 Chris Ryan via R-help, 
wrote:

> Is this a homework problem?
>
> --Chris Ryan
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
>
> On February 5, 2023 9:07:03 AM EST, Upananda Pani 
> wrote:
> >Dear All,
> >
> >I want to create a vector p and extract first 20 observations using subset
> >function based on logical condition.
> >
> >My code is below
> >
> >p <- 0:100
> >
> >I know i can extract the first 20 observations using the following
> command.
> >
> >q <- p[1:20]
> >
> >But I want to extract the first 20 observations using subset function
> which
> >requires a logical condition. I am not able to frame the logical
> condition.
> >
> >The code should be
> >
> >q <- subset(p, logical condition)
> >
> >I am not able to do it. Please let me know what you think.
> >
> >Best regards,
> >Upananda
> >
> >   [[alternative HTML version deleted]]
> >
> >__
> >R-help@r-project.org 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.
>
> __
> R-help@r-project.org 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]]

__
R-help@r-project.org 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.


[R] Extracting data using subset function

2023-02-05 Thread Upananda Pani
Dear All,

I want to create a vector p and extract first 20 observations using subset
function based on logical condition.

My code is below

p <- 0:100

I know i can extract the first 20 observations using the following command.

q <- p[1:20]

But I want to extract the first 20 observations using subset function which
requires a logical condition. I am not able to frame the logical condition.

The code should be

q <- subset(p, logical condition)

I am not able to do it. Please let me know what you think.

Best regards,
Upananda

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Reg: Defining Lagged value of a time series variable

2023-01-18 Thread Upananda Pani
Dear Members,


Greetings! I would like to know how to create the lag variable for my data.
# Load data and create time series object 

oil <- read_xlsx("crudefinal.xlsx")


pricet=ts(oil$price, start = c(2020, 22), frequency = 365)

roilt=ts(diff(log(oil$price))*100,start=c(2020,22),freq=365)



# Fit MSW model 

roilt.lag0 = window(roilt,start=c(2020,23),end=c(2021,215),freq=365) # get
al the lags right

roilt.lag1 = window(roilt,start=c(2020,22),end=c(2021,214),freq=365)

roilt.lag2 = window(roilt,start=c(2020,20),end=c(2021,213),freq=365)

roilt.lag3 = window(roilt,start=c(2020,20),end=c(2021,212),freq=365)

roilt.lag4 = window(roilt,start=c(2020,19),end=c(2021,211),freq=365)



I am getting error (length is not matching), while creating lag. I will
grateful to you if you can tell me where  I am making mistakes.



Regards,

Upananda Pani

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Reg: lag transformation of time series data

2023-01-17 Thread Upananda Pani
Dear Members,



Greetings! I would like to know how to create the lag variable for my data.



# Load data and create time series object 

oil <- read_xlsx("crudefinal.xlsx")



pricet=ts(oil$price, start = c(2020, 22), frequency = 365)

roilt=ts(diff(log(oil$price))*100,start=c(2020,22),freq=365)



# Fit MSW model 

roilt.lag0 = window(roilt,start=c(2020,23),end=c(2021,215),freq=365) # get
al the lags right

roilt.lag1 = window(roilt,start=c(2020,22),end=c(2021,214),freq=365)

roilt.lag2 = window(roilt,start=c(2020,20),end=c(2021,213),freq=365)

roilt.lag3 = window(roilt,start=c(2020,20),end=c(2021,212),freq=365)

roilt.lag4 = window(roilt,start=c(2020,19),end=c(2021,211),freq=365)



I am getting error (length is not matching), while creating lag. I will
grateful to you if you can tell me where  I am making mistakes.



Regards,

Upananda Pani

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Fwd: Reg: Frequency in declaring time series data

2023-01-17 Thread Upananda Pani
Hi Rui,

Thank you so much for your help. As I have to fit a Markov Switching Model
using  MSwM package.

May I know whether i can convert from zoo object to a time series object.

As I have to use several packages which uses ts so I am not able to decide
how to do it.

Grateful to you for your help and support.

With sincere regards,
Upananda

On Tue, 17 Jan, 2023, 01:40 Rui Barradas,  wrote:

> Às 16:39 de 16/01/2023, Upananda Pani escreveu:
> > Dear All,
> >
> > I have a time series daily data with date are stored ( %dd-%mm-%yy
> format )
> > from 22-01-20 to 03-08-21. In total I have 560 observations. I am using
> the
> > following command to declare as a time series object. Here the the data
> set
> > is 7 days a week.
> > oil <- read_xlsx("crudefinal.xlsx")
> > pricet=ts(oil$price, start = c(2020, 22), freq = 365)
> > roilt=ts(diff(log(oil$price))*100,start=c(2020,22), freq=365)
> >
> > Shall I have to declare the dates here?  I want to know also if it is a 5
> > day trading a week, how to declare the frequency.
> >
> > Looking forward to your reply
> >
> > Regards,
> > Upananda Pani
> >
> > Looking forward to your suggestions.
> >
> >   [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org 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.
> Hello,
>
> Package zoo is the best way of having dates in a time series. The
> package comes with several vignettes that can get you started quickly.
> See the difference between classes ts and zoo below.
>
> # make up some test data
> oil <- data.frame(price = cumsum(rnorm(560)))
> oil$date <- seq(as.Date("2020-01-22"), by = "1 day", length.out = 560)
>
> # base R
> pricet <- ts(oil$price, start = c(2020, 22), freq = 365)
> time(pricet)
> index(pricet)
> plot(pricet)
>
> #---
>
> library(zoo)
> library(ggplot2)
>
> pricez <- zoo(oil$price, order.by = oil$date)
> time(pricez)
> index(pricez)
> autoplot(pricez)
>
> vignette(package = "zoo")
>
>
> Hope this helps,
>
> Rui Barradas
>
>
>

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] (no subject)

2023-01-16 Thread Upananda Pani
Dear Members,



Greetings! I would like to know how to create the lag variable for my data.



# Load data and create time series object 

oil <- read_xlsx("crudefinal.xlsx")



pricet=ts(oil$price, start = c(2020, 22), frequency = 365)

roilt=ts(diff(log(oil$price))*100,start=c(2020,22),freq=365)



# Fit MSW model 

roilt.lag0 = window(roilt,start=c(2020,23),end=c(2021,215),freq=365) # get
al the lags right

roilt.lag1 = window(roilt,start=c(2020,22),end=c(2021,214),freq=365)

roilt.lag2 = window(roilt,start=c(2020,20),end=c(2021,213),freq=365)

roilt.lag3 = window(roilt,start=c(2020,20),end=c(2021,212),freq=365)

roilt.lag4 = window(roilt,start=c(2020,19),end=c(2021,211),freq=365)



I am getting error (length is not matching), while creating lag. I will
grateful to you if you can tell me where  I am making mistakes.



Regards,

Upananda Pani

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Reg: Frequency in declaring time series data

2023-01-16 Thread Upananda Pani
Dear All,

I have a time series daily data with date are stored ( %dd-%mm-%yy format )
from 22-01-20 to 03-08-21. In total I have 560 observations. I am using the
following command to declare as a time series object. Here the the data set
is 7 days a week.
oil <- read_xlsx("crudefinal.xlsx")
pricet=ts(oil$price, start = c(2020, 22), freq = 365)
roilt=ts(diff(log(oil$price))*100,start=c(2020,22), freq=365)

Shall I have to declare the dates here?  I want to know also if it is a 5
day trading a week, how to declare the frequency.

Looking forward to your reply

Regards,
Upananda Pani

Looking forward to your suggestions.

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Reg: ggplot error

2023-01-11 Thread Upananda Pani
I am sorry.

On Wed, Jan 11, 2023 at 5:32 PM Eric Berger  wrote:

> No code or data came through.
> Please read the posting guidelines.
>
>
> On Wed, Jan 11, 2023 at 1:38 PM Upananda Pani 
> wrote:
> >
> > Dear All,
> >
> > I am using roptest  function of package "ROptEst" (Kohl and Ruckdeschel
> > (2019)) to find out the ML, CvM-MD, and the RMX estimator and their
> > asymptotic confidence intervals. I am assuming 1-5% of erroneous data for
> > the RMX estimator.
> >
> > Then I am trying to Plot the data in the form of a histogram and add the
> > three Gamma distribution densities with the estimated parameters and
> > validate the three models additionally with pp- and qq-plots.
> >
> > I have tried to code it. I have attached the code and data. I am getting
> > error while fitting ggplot to plot the distribution densities.
> >
> > I am doing some error which I am not able to correct. Please help me to
> > find out my error.
> >
> > With sincere regards,
> > Upananda Pani
> > __
> > R-help@r-project.org 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]]

__
R-help@r-project.org 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.


[R] Reg: ggplot error

2023-01-11 Thread Upananda Pani
Dear All,

I am using roptest  function of package "ROptEst" (Kohl and Ruckdeschel
(2019)) to find out the ML, CvM-MD, and the RMX estimator and their
asymptotic confidence intervals. I am assuming 1-5% of erroneous data for
the RMX estimator.

Then I am trying to Plot the data in the form of a histogram and add the
three Gamma distribution densities with the estimated parameters and
validate the three models additionally with pp- and qq-plots.

I have tried to code it. I have attached the code and data. I am getting
error while fitting ggplot to plot the distribution densities.

I am doing some error which I am not able to correct. Please help me to
find out my error.

With sincere regards,
Upananda Pani
__
R-help@r-project.org 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.


Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Upananda Pani
Thanks Eric. You have found the error. It has saved my time.

Grateful to you for your help and suggestions.

Regards,
Upananda

On Mon, Dec 26, 2022 at 7:59 PM Eric Berger  wrote:

> Your problem is that the color "#4DAF4A8" is not a valid color. It should
> have only 6 hex digits.
> e.g. "#4DAF4A" will work.
>
> Also you seem to be confused about ggplot. You are not using ggplot in
> your code at all.
> You are using base graphics. You can remove the 3 library calls.
>
> HTH,
> Eric
>
>
> On Mon, Dec 26, 2022 at 4:06 PM Upananda Pani 
> wrote:
>
>> Dear All,
>>
>> I am trying to plot a scatter plot between  temperature and heart rate and
>> additionally marking the outcome of the patients by colors. I am using the
>> standard package Use the standard function plot as well as the functions
>> of
>> package "ggplot2" (Wickham (2009)). Save the plots in pdf files.
>>
>> I am geeting an error to plot when assigning colsOutcome to the
>> scatterplot. I am doing it wrongly. Please advise me.
>> ```{r}
>> library(ggplot2)
>> library(RColorBrewer)
>> library(ggsci)
>> ICUData <- read.csv(file = "ICUData.csv")
>> ```
>> ```{r}
>> ## Generate empty vector
>> colsOutcome <- character(nrow(ICUData))
>> ## Fill with colors
>> colsOutcome[ICUData$outcome == "died"] <- "#E41A1C"
>> colsOutcome[ICUData$outcome == "home"] <- "#377EB8"
>> colsOutcome[ICUData$outcome == "other hospital"] <- "#4DAF4A8"
>> colsOutcome[ICUData$outcome == "secondary care/rehab"] <- "#984EA3"
>> ```
>>
>> ```{r}
>> plot(x = ICUData$temperature, y = ICUData$heart.rate, pch = 19,
>>  xlab = "Maximum body temperature", ylab = "Maximum heart rate",
>>  main = "500 ICU patients", col = colsOutcome, xlim = c(33,43))
>> legend(x = "topleft", legend = c("died", "home", "other hospital",
>> "secondary care/rehab"), pch = 19,
>>col = c("#E41A1C", "#377EB8", "#4DAF4A8", "#984EA3"))
>> ```
>> __
>> R-help@r-project.org 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]]

__
R-help@r-project.org 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.


Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Upananda Pani
Hi John,

Greetings! I am grateful to your suggestions. I have fixed the error as per
your suggestions.

Many thanks to you for saving my time.

With sincere regards,
Upananda Pani

On Mon, Dec 26, 2022 at 9:09 PM John Kane  wrote:

> Here is a rough guess at what you may want with a bit of mock data and
> using ggplot2.
> ##=#
> library(ggplot2)
> library(RColorBrewer)
>
> dat1  <- data.frame(aa = sample(1:10, 20, replace = TRUE), bb =
> sample(21:30, 20, replace = TRUE),
> outcome = sample(c("died", "home", "other
> hospital","secondary care/rehab"), 20, replace = TRUE ))
> ggplot(dat1, aes(aa, bb, colour = outcome)) + geom_point() +
> scale_colour_brewer(palette = "Dark2") +
> labs(
> x = "Maximum body temperature",
> y =  "Maximum heart rate",
> colour = "outcome",
> title ="500 ICU patients"
> )
>  ####
>
> On Mon, 26 Dec 2022 at 09:46, John Kane  wrote:
>
>> I suspect you may be mixing *plot()* commands with *ggplot()* commands
>> and they are likely incompatible.
>>
>> Could you supply some sample data and any error messages that you are
>> getting?   A handy way to supply some sample data is the dput() function.
>> In the case of a large dataset something like dput(head(mydata, 100))
>> should supply the data we need.
>>
>> On Mon, 26 Dec 2022 at 09:06, Upananda Pani 
>> wrote:
>>
>>> Dear All,
>>>
>>> I am trying to plot a scatter plot between  temperature and heart rate
>>> and
>>> additionally marking the outcome of the patients by colors. I am using
>>> the
>>> standard package Use the standard function plot as well as the functions
>>> of
>>> package "ggplot2" (Wickham (2009)). Save the plots in pdf files.
>>>
>>> I am geeting an error to plot when assigning colsOutcome to the
>>> scatterplot. I am doing it wrongly. Please advise me.
>>> ```{r}
>>> library(ggplot2)
>>> library(RColorBrewer)
>>> library(ggsci)
>>> ICUData <- read.csv(file = "ICUData.csv")
>>> ```
>>> ```{r}
>>> ## Generate empty vector
>>> colsOutcome <- character(nrow(ICUData))
>>> ## Fill with colors
>>> colsOutcome[ICUData$outcome == "died"] <- "#E41A1C"
>>> colsOutcome[ICUData$outcome == "home"] <- "#377EB8"
>>> colsOutcome[ICUData$outcome == "other hospital"] <- "#4DAF4A8"
>>> colsOutcome[ICUData$outcome == "secondary care/rehab"] <- "#984EA3"
>>> ```
>>>
>>> ```{r}
>>> plot(x = ICUData$temperature, y = ICUData$heart.rate, pch = 19,
>>>  xlab = "Maximum body temperature", ylab = "Maximum heart rate",
>>>  main = "500 ICU patients", col = colsOutcome, xlim = c(33,43))
>>> legend(x = "topleft", legend = c("died", "home", "other hospital",
>>> "secondary care/rehab"), pch = 19,
>>>col = c("#E41A1C", "#377EB8", "#4DAF4A8", "#984EA3"))
>>> ```
>>> __
>>> R-help@r-project.org 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.
>>>
>>
>>
>> --
>> John Kane
>> Kingston ON Canada
>>
>
>
> --
> John Kane
> Kingston ON Canada
>

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Upananda Pani
Hi John,

Thanks for your reply. I have tried the following code.

```{r}
ggplot(ICUData[-398,], aes(x=temperature, y=heart.rate, colour=outcome)) +
  ## shape = 19: somewhat larger point
  ## alpha = 0.4: strengs of blending
  geom_point(shape=19, alpha=0.4) +
  ## colors
  scale_colour_manual(values = c("#E41A1C", "#377EB8", "#4DAF4A",
"#984EA3")) +
  ## labeling
  ggtitle("500 ICU patients") + xlab("Maximum body temperature") +
  ylab("Maximum heart frequency")
```
However, I will try with your solution. Thanks for your time.

With sincere regards,
Upananda Pani



On Mon, Dec 26, 2022 at 9:09 PM John Kane  wrote:

> Here is a rough guess at what you may want with a bit of mock data and
> using ggplot2.
> ##=#
> library(ggplot2)
> library(RColorBrewer)
>
> dat1  <- data.frame(aa = sample(1:10, 20, replace = TRUE), bb =
> sample(21:30, 20, replace = TRUE),
> outcome = sample(c("died", "home", "other
> hospital","secondary care/rehab"), 20, replace = TRUE ))
> ggplot(dat1, aes(aa, bb, colour = outcome)) + geom_point() +
> scale_colour_brewer(palette = "Dark2") +
> labs(
> x = "Maximum body temperature",
> y =  "Maximum heart rate",
> colour = "outcome",
> title ="500 ICU patients"
> )
>  ####
>
> On Mon, 26 Dec 2022 at 09:46, John Kane  wrote:
>
>> I suspect you may be mixing *plot()* commands with *ggplot()* commands
>> and they are likely incompatible.
>>
>> Could you supply some sample data and any error messages that you are
>> getting?   A handy way to supply some sample data is the dput() function.
>> In the case of a large dataset something like dput(head(mydata, 100))
>> should supply the data we need.
>>
>> On Mon, 26 Dec 2022 at 09:06, Upananda Pani 
>> wrote:
>>
>>> Dear All,
>>>
>>> I am trying to plot a scatter plot between  temperature and heart rate
>>> and
>>> additionally marking the outcome of the patients by colors. I am using
>>> the
>>> standard package Use the standard function plot as well as the functions
>>> of
>>> package "ggplot2" (Wickham (2009)). Save the plots in pdf files.
>>>
>>> I am geeting an error to plot when assigning colsOutcome to the
>>> scatterplot. I am doing it wrongly. Please advise me.
>>> ```{r}
>>> library(ggplot2)
>>> library(RColorBrewer)
>>> library(ggsci)
>>> ICUData <- read.csv(file = "ICUData.csv")
>>> ```
>>> ```{r}
>>> ## Generate empty vector
>>> colsOutcome <- character(nrow(ICUData))
>>> ## Fill with colors
>>> colsOutcome[ICUData$outcome == "died"] <- "#E41A1C"
>>> colsOutcome[ICUData$outcome == "home"] <- "#377EB8"
>>> colsOutcome[ICUData$outcome == "other hospital"] <- "#4DAF4A8"
>>> colsOutcome[ICUData$outcome == "secondary care/rehab"] <- "#984EA3"
>>> ```
>>>
>>> ```{r}
>>> plot(x = ICUData$temperature, y = ICUData$heart.rate, pch = 19,
>>>  xlab = "Maximum body temperature", ylab = "Maximum heart rate",
>>>  main = "500 ICU patients", col = colsOutcome, xlim = c(33,43))
>>> legend(x = "topleft", legend = c("died", "home", "other hospital",
>>> "secondary care/rehab"), pch = 19,
>>>col = c("#E41A1C", "#377EB8", "#4DAF4A8", "#984EA3"))
>>> ```
>>> __
>>> R-help@r-project.org 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.
>>>
>>
>>
>> --
>> John Kane
>> Kingston ON Canada
>>
>
>
> --
> John Kane
> Kingston ON Canada
>

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Reg: Help in assigning colors to factor variable in ggplot2

2022-12-26 Thread Upananda Pani
Dear All,

I am trying to plot a scatter plot between  temperature and heart rate and
additionally marking the outcome of the patients by colors. I am using the
standard package Use the standard function plot as well as the functions of
package "ggplot2" (Wickham (2009)). Save the plots in pdf files.

I am geeting an error to plot when assigning colsOutcome to the
scatterplot. I am doing it wrongly. Please advise me.
```{r}
library(ggplot2)
library(RColorBrewer)
library(ggsci)
ICUData <- read.csv(file = "ICUData.csv")
```
```{r}
## Generate empty vector
colsOutcome <- character(nrow(ICUData))
## Fill with colors
colsOutcome[ICUData$outcome == "died"] <- "#E41A1C"
colsOutcome[ICUData$outcome == "home"] <- "#377EB8"
colsOutcome[ICUData$outcome == "other hospital"] <- "#4DAF4A8"
colsOutcome[ICUData$outcome == "secondary care/rehab"] <- "#984EA3"
```

```{r}
plot(x = ICUData$temperature, y = ICUData$heart.rate, pch = 19,
 xlab = "Maximum body temperature", ylab = "Maximum heart rate",
 main = "500 ICU patients", col = colsOutcome, xlim = c(33,43))
legend(x = "topleft", legend = c("died", "home", "other hospital",
"secondary care/rehab"), pch = 19,
   col = c("#E41A1C", "#377EB8", "#4DAF4A8", "#984EA3"))
```
__
R-help@r-project.org 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.


Re: [R] Reg: To change the x axis label in ts.plot function

2022-12-25 Thread Upananda Pani
Hi Jim,

Thank you so much. It worked. I got the exact solution which i was looking
for.

I am grateful to you for your help

With sincere regards,
Upananda

On Sun, Dec 25, 2022 at 3:48 AM Jim Lemon  wrote:

> Hi Upananda,
> First, the date sequence you are using doesn't match the dates you
> specify in your post. The code below may give you what you want:
>
> # make up some prices
> price<-c(seq(60,25,length.out=25),seq(25,70,length.out=54))+rnorm(79)
> pricet <- ts(price, start =
> as.Date("2020-01-27"),end=as.Date("2021-07-26"),
> frequency=1/7)
> plot(pricet,xaxt="n")
> axis_dates<-as.Date(c("2020-06-30","2021-01-01","2021-06-30"))
> axis(1,at=axis_dates,labels=format(axis_dates,"%d/%m/%Y"))
>
> Jim
>
> On Sun, Dec 25, 2022 at 5:58 AM Upananda Pani 
> wrote:
> >
> >   Dear All,
> >  I have the data set with daily dates (5-days trading in a week) and
> price
> > data. I want to change the x axis labels to the plot. I am using ts.plot
> > function to plot my data. My data spans from 2020-01-27 to 2021-07-30. I
> > want to change it to D-M-Y first. Then I want to show all the dates with
> a
> > one week gap in my x-axis label.
> >
> >  The following code I am using:
> >  pricet <- ts(price, start = c(2020, 27), frequency = 260)
> > plot.ts(pricet)
> >
> > Please advise me how to achieve the desired result. I have attached my
> data
> > and the plot which I am currently getting with ts.plot.
> >
> > With sincere regards,
> > Upananda Pani
> > __
> > R-help@r-project.org 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]]

__
R-help@r-project.org 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.


[R] Reg: To change the x axis label in ts.plot function

2022-12-24 Thread Upananda Pani
  Dear All,
 I have the data set with daily dates (5-days trading in a week) and price
data. I want to change the x axis labels to the plot. I am using ts.plot
function to plot my data. My data spans from 2020-01-27 to 2021-07-30. I
want to change it to D-M-Y first. Then I want to show all the dates with a
one week gap in my x-axis label.

 The following code I am using:
 pricet <- ts(price, start = c(2020, 27), frequency = 260)
plot.ts(pricet)

Please advise me how to achieve the desired result. I have attached my data
and the plot which I am currently getting with ts.plot.

With sincere regards,
Upananda Pani
__
R-help@r-project.org 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.


[R] Converting irregular time series data into ts object

2020-02-19 Thread Upananda Pani
Dear All,

I want to convert irregular time series daily data in to ts objects. For
some years I have 305 days data and some years I have 256 days.

I need your suggestion regarding the same.

I have read tutorial on the same but not able to find solutions.

With regards,
Upananda

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


Re: [R] Convert data into zoo object using Performance analytics package

2017-09-22 Thread Upananda Pani
Dear All,

Thanks a lot for your help. Would you please let me know if i want to read
a csv file as zoo object from my local file rather than directly from the
website, how to do that?

library(zoo)
u  <- "https://faculty.washington.edu/ezivot/econ424/sbuxPrices.csv;
fmt <- "%m/%d/%Y"

With sincere regards,
Upananda Pani

On Wed, Sep 20, 2017 at 3:22 PM, PIKAL Petr <petr.pi...@precheza.cz> wrote:

> Hi
>
> Gabor's code works as expeceted without error.
> What is "u" in your case?
>
> Cheers
> Petr
>
> > -Original Message-
> > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Upananda
> > Pani
> > Sent: Wednesday, September 20, 2017 11:06 AM
> > To: Gabor Grothendieck <ggrothendi...@gmail.com>
> > Cc: r-help <r-help@r-project.org>
> > Subject: Re: [R] Convert data into zoo object using Performance analytics
> > package
> >
> > Dear Sir,
> >
> > Thanks for your mail and help. I got this error while trying to run your
> code.
> >
> > sbux1.z <- read.csv.zoo(u, FUN = as.yearmon, format = fmt) Error in
> > read.table(file = file, header = header, sep = sep, quote = quote,
> >  :
> >   'file' must be a character string or connection
> >
> > Thanks and Regards,
> > Upananda Pani
> >
> > On Tue, Sep 19, 2017 at 4:31 PM, Upananda Pani <upananda.p...@gmail.com>
> > wrote:
> >
> > > Dear Sir,
> > >
> > > Thanks for your mail and help. I got this error while trying to run
> > > your code.
> > >
> > > sbux1.z <- read.csv.zoo(u, FUN = as.yearmon, format = fmt) Error in
> > > read.table(file = file, header = header, sep = sep, quote = quote,  :
> > >   'file' must be a character string or connection
> > >
> > > Thanks and Regards,
> > > Upananda Pani
> > >
> > > On Mon, Sep 18, 2017 at 7:38 PM, Gabor Grothendieck <
> > > ggrothendi...@gmail.com> wrote:
> > >
> > >> Depending on how you created df maybe your code has the column names
> > >> wrong.  In any case these 4 alternatives all work.  Start a fresh R
> > >> session and then copy and paste this into it.
> > >>
> > >> library(zoo)
> > >> u  <- "https://faculty.washington.edu/ezivot/econ424/sbuxPrices.csv;
> > >> fmt <- "%m/%d/%Y"
> > >>
> > >> # 1
> > >> sbux1.z <- read.csv.zoo(u, FUN = as.yearmon, format = fmt)
> > >>
> > >> # 2
> > >> df <- read.csv(u)
> > >> sbux2.z <- read.zoo(df, FUN = as.yearmon, format = fmt)
> > >>
> > >> # 3
> > >> df <- read.csv(u)
> > >> names(head(df))
> > >> ## [1] "Date"  "Adj.Close"
> > >> sbux3.z <- zoo(df$Adj.Close, as.yearmon(df$Date, fmt))
> > >>
> > >> # 4
> > >> df <- read.csv(u)
> > >> sbux4.z <- zoo(df[[2]], as.yearmon(df[[1]], fmt))
> > >>
> > >> On Mon, Sep 18, 2017 at 7:36 AM, Upananda Pani
> > >> <upananda.p...@gmail.com>
> > >> wrote:
> > >> > Dear All,
> > >> >
> > >> > While i am trying convert data frame object to zoo object I am
> > >> > getting numeric(0) error in performance analytics package.
> > >> >
> > >> > The source code i am using from this website to learn r in finance:
> > >> > https://faculty.washington.edu/ezivot/econ424/returnCalculations.r
> > >> >
> > >> > # create zoo objects from data.frame objects dates.sbux =
> > >> > as.yearmon(sbux.df$Date, format="%m/%d/%Y") dates.msft =
> > >> > as.yearmon(msft.df$Date, format="%m/%d/%Y") sbux.z =
> > >> > zoo(x=sbux.df$Adj.Close, order.by=dates.sbux) msft.z =
> > >> > zoo(x=msft.df$Adj.Close, order.by=dates.msft)
> > >> > class(sbux.z)
> > >> > head(sbux.z)
> > >> >> head(sbux.z)
> > >> > Data:
> > >> > numeric(0)
> > >> >
> > >> > I will be grateful if anybody would like to guide me where i am
> > >> > making
> > >> the
> > >> > mistake.
> > >> >
> > >> > With best regards,
> > >> > Upananda Pani
> > >> >
> > >> >
> > >> > --
> > >> >
> > >> >
> > >> > You may delay, but 

[R] Treating NA in timeSeries package

2017-09-22 Thread Upananda Pani
Dear All,

I am facing problem with NA treatment in my financial time series data.

# data reading

aluminum = read.csv(file="alu.csv", header=T, sep=",")

fut = aluminum [,2]
spt = aluminum [,3]


# Missing Value Treatment (Linear Interpolation)
spt = interpNA(spt, method = c("linear"))
fut = interpNA(fut, method = c("linear"))


fut=fut[,1]
spt =spt[,1]

spt = interpNA(spt, method = c("linear"))
Error in interpNA(spt, method = c("linear")) : spt is not a tis object
> fut = interpNA(fut, method = c("linear"))
Error in interpNA(fut, method = c("linear")) : fut is not a tis object

Then i want to convert my data into time series as following
# Making Time Series
fut = ts(fut, start=c(2006,4), frequency=305)
spt = ts(spt, start=c(2006,4), frequency=305)

Would you please guide me what is the problem with my code?

With best regards,
Upananda Pani
__
R-help@r-project.org 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.


Re: [R] Convert data into zoo object using Performance analytics package

2017-09-20 Thread Upananda Pani
Dear Sir,

Thanks for your mail and help. I got this error while trying to run your
code.

sbux1.z <- read.csv.zoo(u, FUN = as.yearmon, format = fmt)
Error in read.table(file = file, header = header, sep = sep, quote = quote,
 :
  'file' must be a character string or connection

Thanks and Regards,
Upananda Pani

On Tue, Sep 19, 2017 at 4:31 PM, Upananda Pani <upananda.p...@gmail.com>
wrote:

> Dear Sir,
>
> Thanks for your mail and help. I got this error while trying to run your
> code.
>
> sbux1.z <- read.csv.zoo(u, FUN = as.yearmon, format = fmt)
> Error in read.table(file = file, header = header, sep = sep, quote =
> quote,  :
>   'file' must be a character string or connection
>
> Thanks and Regards,
> Upananda Pani
>
> On Mon, Sep 18, 2017 at 7:38 PM, Gabor Grothendieck <
> ggrothendi...@gmail.com> wrote:
>
>> Depending on how you created df maybe your code has the column names
>> wrong.  In any case these 4 alternatives all work.  Start a fresh R
>> session and then copy and paste this into it.
>>
>> library(zoo)
>> u  <- "https://faculty.washington.edu/ezivot/econ424/sbuxPrices.csv;
>> fmt <- "%m/%d/%Y"
>>
>> # 1
>> sbux1.z <- read.csv.zoo(u, FUN = as.yearmon, format = fmt)
>>
>> # 2
>> df <- read.csv(u)
>> sbux2.z <- read.zoo(df, FUN = as.yearmon, format = fmt)
>>
>> # 3
>> df <- read.csv(u)
>> names(head(df))
>> ## [1] "Date"  "Adj.Close"
>> sbux3.z <- zoo(df$Adj.Close, as.yearmon(df$Date, fmt))
>>
>> # 4
>> df <- read.csv(u)
>> sbux4.z <- zoo(df[[2]], as.yearmon(df[[1]], fmt))
>>
>> On Mon, Sep 18, 2017 at 7:36 AM, Upananda Pani <upananda.p...@gmail.com>
>> wrote:
>> > Dear All,
>> >
>> > While i am trying convert data frame object to zoo object I am
>> > getting numeric(0) error in performance analytics package.
>> >
>> > The source code i am using from this website to learn r in finance:
>> > https://faculty.washington.edu/ezivot/econ424/returnCalculations.r
>> >
>> > # create zoo objects from data.frame objects
>> > dates.sbux = as.yearmon(sbux.df$Date, format="%m/%d/%Y")
>> > dates.msft = as.yearmon(msft.df$Date, format="%m/%d/%Y")
>> > sbux.z = zoo(x=sbux.df$Adj.Close, order.by=dates.sbux)
>> > msft.z = zoo(x=msft.df$Adj.Close, order.by=dates.msft)
>> > class(sbux.z)
>> > head(sbux.z)
>> >> head(sbux.z)
>> > Data:
>> > numeric(0)
>> >
>> > I will be grateful if anybody would like to guide me where i am making
>> the
>> > mistake.
>> >
>> > With best regards,
>> > Upananda Pani
>> >
>> >
>> > --
>> >
>> >
>> > You may delay, but time will not.
>> >
>> >
>> > Research Scholar
>> > alternative mail id: up...@iitkgp.ac.in
>> > Department of HSS, IIT KGP
>> > KGP
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > __
>> > R-help@r-project.org 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.
>>
>>
>>
>> --
>> Statistics & Software Consulting
>> GKX Group, GKX Associates Inc.
>> tel: 1-877-GKX-GROUP
>> email: ggrothendieck at gmail.com
>>
>
>
>
> --
>
>
> You may delay, but time will not.
>
>
> Research Scholar
> alternative mail id: up...@iitkgp.ac.in
> Department of HSS, IIT KGP
> KGP
>



-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] Convert data into zoo object using Performance analytics package

2017-09-18 Thread Upananda Pani
Dear All,

While i am trying convert data frame object to zoo object I am
getting numeric(0) error in performance analytics package.

The source code i am using from this website to learn r in finance:
https://faculty.washington.edu/ezivot/econ424/returnCalculations.r

# create zoo objects from data.frame objects
dates.sbux = as.yearmon(sbux.df$Date, format="%m/%d/%Y")
dates.msft = as.yearmon(msft.df$Date, format="%m/%d/%Y")
sbux.z = zoo(x=sbux.df$Adj.Close, order.by=dates.sbux)
msft.z = zoo(x=msft.df$Adj.Close, order.by=dates.msft)
class(sbux.z)
head(sbux.z)
> head(sbux.z)
Data:
numeric(0)

I will be grateful if anybody would like to guide me where i am making the
mistake.

With best regards,
Upananda Pani


-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@r-project.org 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.


[R] reading data using XTS package

2014-11-18 Thread Upananda Pani
Dear All,

I want to read the my time series data using XTS package and then to
calculate return using PeformanceAnalytics Package  but i am getting the
following error. Please help me to solve the problem. The error follows:

# Required Libraries
 library(xts)
 library(PerformanceAnalytics)

 #Reading Data
 x-read.csv('crude.csv')
 y-xts(x[,1:2],as.numeric(x[,2:2]),order.by
=as.Date(x[,1],format='%d-%b-%y'))
 close - y$close

 #Calculating Return
 rspot = Return.calculate(close, method = c (discrete))
Error in `/.default`(pr, lag(pr)) :
  non-numeric argument to binary operator


I am not getting where i am committing the mistake.

With sincere regards,
Upananda

-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP
__
R-help@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.


[R] treating missing values in timeSeries package

2014-11-01 Thread Upananda Pani
Dear All,

I am getting the following error when i am using interpNA function from
timeSeries package

# Missing Value Treatment (Linear Interpolation)
 spt = interpNA(spt, method = c(linear))
Error in interpNA(spt, method = c(linear)) : spt is not a tis object
 fut = interpNA(fut, method = c(linear))
Error in interpNA(fut, method = c(linear)) : fut is not a tis object
 spt = ts(spt, start=c(2006,4), frequency=305)
 fut = ts(fut, start=c(2006,4), frequency=305)
 spt = interpNA(spt, method = c(linear))

Would you please help me in this regard.

With sincere regards,
Upananda

-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP
__
R-help@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.


[R] converting individual data series to natural log (continuously compounded return)

2014-10-31 Thread Upananda Pani
Hi All,

I want to convert my price data into  natural log (continuously compounded
return)  by using Performance Analytics Package, I am getting the following
error.

 rfut = Return.calculate(fut)
Error in checkData(prices, method = xts) :


Please help me.

With sincere regards,
Upananda

-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP
__
R-help@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.


[R] non causality test and wavelet decompostion

2014-07-13 Thread Upananda Pani
Dear All,

Is there any package to perform linear and nonlinear causality test with
frequency bands. In the non linear causality the model can take any of the
specification which includes Semi-additive, P-general Taylor based,
ANN-based.

This is also done in Wavelet decomposition.

Please suggest me some procedure to perform these test.

With sincere regards,
Upananda

-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


[R] how to install R 3.0.1

2013-05-31 Thread Upananda Pani
Hi All,

I want to switch over from 2.13.1 to 3.0.1. Is it advisable to switch over.
I am using Windows Vista.

Please suggest me installation procedure as i am not very comfortable in
Installing R and If any good documentations can be found, Please send me
the link.

Thanks and Regards,
Upananda

-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] how to install R 3.0.1

2013-05-31 Thread Upananda Pani
Hi John,

I am using Microsoft Window Vista Service Pack 2.

Regards,
Upananda


On Fri, May 31, 2013 at 6:47 PM, John Kane jrkrid...@inbox.com wrote:

 http://www.r-project.org/ and go from there I imagine.

 You did not supply any information about your operating system so it is
 difficult to give more detailed advice.

 John Kane
 Kingston ON Canada


  -Original Message-
  From: upananda.p...@gmail.com
  Sent: Fri, 31 May 2013 18:11:28 +0530
  To: r-help@r-project.org
  Subject: [R] how to install R 3.0.1
 
  Hi All,
 
  I want to switch over from 2.13.1 to 3.0.1. Is it advisable to switch
  over.
  I am using Windows Vista.
 
  Please suggest me installation procedure as i am not very comfortable in
  Installing R and If any good documentations can be found, Please send me
  the link.
 
  Thanks and Regards,
  Upananda
 
  --
 
 
  You may delay, but time will not.
 
 
  Research Scholar
  alternative mail id: up...@iitkgp.ac.in
  Department of HSS, IIT KGP
  KGP
 
[[alternative HTML version deleted]]
 
  __
  R-help@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.

 
 FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks  orcas on
 your desktop!
 Check it out at http://www.inbox.com/marineaquarium





-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] how to install R 3.0.1

2013-05-31 Thread Upananda Pani
Hi John,

Thanks for your reply .How to Update all the packages ( Which i am already
using ) automatically to the new version.?


With regards,
Upananda





On Fri, May 31, 2013 at 7:01 PM, John Kane jrkrid...@inbox.com wrote:

 Sorry I misread your post.  Just download the 3.0.1 for Windows and
 install.  You will need to reinstall any additional packages that you have
 installed.

 John Kane
 Kingston ON Canada


  -Original Message-
  From: upananda.p...@gmail.com
  Sent: Fri, 31 May 2013 18:11:28 +0530
  To: r-help@r-project.org
  Subject: [R] how to install R 3.0.1
 
  Hi All,
 
  I want to switch over from 2.13.1 to 3.0.1. Is it advisable to switch
  over.
  I am using Windows Vista.
 
  Please suggest me installation procedure as i am not very comfortable in
  Installing R and If any good documentations can be found, Please send me
  the link.
 
  Thanks and Regards,
  Upananda
 
  --
 
 
  You may delay, but time will not.
 
 
  Research Scholar
  alternative mail id: up...@iitkgp.ac.in
  Department of HSS, IIT KGP
  KGP
 
[[alternative HTML version deleted]]
 
  __
  R-help@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.

 
 FREE ONLINE PHOTOSHARING - Share your photos online with your friends and
 family!
 Visit http://www.inbox.com/photosharing to find out more!





-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] how to install R 3.0.1

2013-05-31 Thread Upananda Pani
When I am updating packages, I got the following output:

The downloaded binary packages are in
C:\Users\upani\AppData\Local\Temp\RtmpmC7A9U\downloaded_packages
So What to do after this ?


On Fri, May 31, 2013 at 7:49 PM, Steve Friedman skfgla...@gmail.com wrote:

 Thanks for the clarification.
 On May 31, 2013 10:19 AM, Prof Brian Ripley rip...@stats.ox.ac.uk
 wrote:

 On 31/05/2013 14:44, Steve Friedman wrote:

 You can't. You must copy them to the new installation directory. After
 that
 you can use the update package command to check for and install the
 upgrades packages.


 Not so if you organized your packages sensibly in a separate library. See
 http://cran.r-project.org/bin/**windows/base/rw-FAQ.html#What_**
 0027s-the-best-way-to-upgrade_**003fhttp://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f(and
  the rest of that FAQ).



  On May 31, 2013 9:43 AM, Upananda Pani upananda.p...@gmail.com
 wrote:

  Hi John,

 Thanks for your reply .How to Update all the packages ( Which i am
 already
 using ) automatically to the new version.?


 With regards,
 Upananda





 On Fri, May 31, 2013 at 7:01 PM, John Kane jrkrid...@inbox.com wrote:

  Sorry I misread your post.  Just download the 3.0.1 for Windows and
 install.  You will need to reinstall any additional packages that you

 have

 installed.

 John Kane
 Kingston ON Canada


  -Original Message-
 From: upananda.p...@gmail.com
 Sent: Fri, 31 May 2013 18:11:28 +0530
 To: r-help@r-project.org
 Subject: [R] how to install R 3.0.1

 Hi All,

 I want to switch over from 2.13.1 to 3.0.1. Is it advisable to switch
 over.
 I am using Windows Vista.

 Please suggest me installation procedure as i am not very comfortable

 in

 Installing R and If any good documentations can be found, Please send

 me

 the link.

 Thanks and Regards,
 Upananda

 --


 You may delay, but time will not.


 Research Scholar
 alternative mail id: up...@iitkgp.ac.in
 Department of HSS, IIT KGP
 KGP

[[alternative HTML version deleted]]

 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/**posting-guide.htmlhttp://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


 __**__
 FREE ONLINE PHOTOSHARING - Share your photos online with your friends
 and
 family!
 Visit 
 http://www.inbox.com/**photosharinghttp://www.inbox.com/photosharingto 
 find out more!





 --


 You may delay, but time will not.


 Research Scholar
 alternative mail id: up...@iitkgp.ac.in
 Department of HSS, IIT KGP
 KGP

  [[alternative HTML version deleted]]

 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/**posting-guide.htmlhttp://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


 [[alternative HTML version deleted]]

 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/**
 posting-guide.html http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.



 --
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Professor of Applied Statistics,  
 http://www.stats.ox.ac.uk/~**ripley/http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595




-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] how to install R 3.0.1

2013-05-31 Thread Upananda Pani
Does it mean the packages are already updated ?


On Fri, May 31, 2013 at 9:35 PM, Prof Brian Ripley rip...@stats.ox.ac.ukwrote:

 On 31/05/2013 16:53, Upananda Pani wrote:

 When I am updating packages, I got the following output:

 The downloaded binary packages are in
  C:\Users\upani\AppData\Local\**Temp\RtmpmC7A9U\downloaded_**
 packages
 So What to do after this ?


 Nothing.  These will be removed when you quit R.



 On Fri, May 31, 2013 at 7:49 PM, Steve Friedman skfgla...@gmail.com
 mailto:skfgla...@gmail.com wrote:

 Thanks for the clarification.

 On May 31, 2013 10:19 AM, Prof Brian Ripley rip...@stats.ox.ac.uk
 mailto:rip...@stats.ox.ac.uk** wrote:

 On 31/05/2013 14:44, Steve Friedman wrote:

 You can't. You must copy them to the new installation
 directory. After that
 you can use the update package command to check for and
 install the
 upgrades packages.


 Not so if you organized your packages sensibly in a separate
 library. See
 http://cran.r-project.org/bin/**__windows/base/rw-FAQ.html#**
 What___0027s-the-best-way-to-**upgrade___003fhttp://cran.r-project.org/bin/__windows/base/rw-FAQ.html#What___0027s-the-best-way-to-upgrade___003f

 http://cran.r-project.org/**bin/windows/base/rw-FAQ.html#**
 What_0027s-the-best-way-to-**upgrade_003fhttp://cran.r-project.org/bin/windows/base/rw-FAQ.html#What_0027s-the-best-way-to-upgrade_003f
 
 (and the rest of that FAQ).



 On May 31, 2013 9:43 AM, Upananda Pani
 upananda.p...@gmail.com 
 mailto:upananda.pani@gmail.**comupananda.p...@gmail.com
 

 wrote:

 Hi John,

 Thanks for your reply .How to Update all the packages (
 Which i am already
 using ) automatically to the new version.?


 With regards,
 Upananda





 On Fri, May 31, 2013 at 7:01 PM, John Kane
 jrkrid...@inbox.com mailto:jrkrid...@inbox.com wrote:

 Sorry I misread your post.  Just download the 3.0.1
 for Windows and
 install.  You will need to reinstall any additional
 packages that you

 have

 installed.

 John Kane
 Kingston ON Canada


 -Original Message-
 From: upananda.p...@gmail.com
 
 mailto:upananda.pani@gmail.**comupananda.p...@gmail.com
 
 Sent: Fri, 31 May 2013 18:11:28 +0530
 To: r-help@r-project.org
 mailto:r-help@r-project.org
 Subject: [R] how to install R 3.0.1

 Hi All,

 I want to switch over from 2.13.1 to 3.0.1. Is
 it advisable to switch
 over.
 I am using Windows Vista.

 Please suggest me installation procedure as i am
 not very comfortable

 in

 Installing R and If any good documentations can
 be found, Please send

 me

 the link.

 Thanks and Regards,
 Upananda

 --


 You may delay, but time will not.


 Research Scholar
 alternative mail id: up...@iitkgp.ac.in
 mailto:up...@iitkgp.ac.in

 Department of HSS, IIT KGP
 KGP

 [[alternative HTML version deleted]]

 __**
 __
 R-help@r-project.org
 mailto:R-help@r-project.org mailing list
 
 https://stat.ethz.ch/mailman/_**_listinfo/r-helphttps://stat.ethz.ch/mailman/__listinfo/r-help

 
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 
 PLEASE do read the posting guide
 
 http://www.R-project.org/__**posting-guide.htmlhttp://www.R-project.org/__posting-guide.html

 
 http://www.R-project.org/**posting-guide.htmlhttp://www.R-project.org/posting-guide.html
 
 and provide commented, minimal, self-contained,
 reproducible code.


 __**
 __**__

 FREE ONLINE PHOTOSHARING - Share your photos online
 with your friends and
 family

Re: [R] how to install R 3.0.1

2013-05-31 Thread Upananda Pani
Hi All,

Thanks all for your kind help else it would have been very tough to go
ahead. I convey my regards to all of you.

Upananda


On Fri, May 31, 2013 at 10:35 PM, John Kane jrkrid...@inbox.com wrote:

 Arh, a sloppy copy and paste.

 Thanks

 John Kane
 Kingston ON Canada


  -Original Message-
  From: maitra.mbox.igno...@inbox.com
  Sent: Fri, 31 May 2013 11:59:05 -0500
  To: r-h...@stat.math.ethz.ch
  Subject: Re: [R] how to install R 3.0.1
 
  Hi John,
 
  I suspect you may be missing a c()?
 
  On Fri, 31 May 2013 06:05:45 -0800 John Kane jrkrid...@inbox.com
  wrote:
 
  paks  -  install.packages( Hmisc, plyr)
 
  paks - install.packages( c(Hmisc, plyr))
 
 
install.packages(paks)
 
  You can use the command  library()  to get a list of what is installed
  on your machine.
 
  Is it possible to get this as a vector of only the package names, or
  is post-processing the output of library() the only way out?
 
  Ranjan
 
 
  --
  Important Notice: This mailbox is ignored: e-mails are set to be
  deleted on receipt. For those needing to send personal or professional
  e-mail, please use appropriate addresses.
 
  
  FREE 3D MARINE AQUARIUM SCREENSAVER - Watch dolphins, sharks  orcas on
  your desktop!
 
  __
  R-help@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.

 
 FREE ONLINE PHOTOSHARING - Share your photos online with your friends and
 family!
 Visit http://www.inbox.com/photosharing to find out more!

 __
 R-help@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.




-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


[R] MGARCH BEKK estimation

2011-10-10 Thread upananda pani
Dear All,

I want to estimate Bivariate Garch Model using MGARCHBEKK package. I am not
able to understand some part of the command this function.

mvBEKK.est(eps=lrdata, order = c(1,1), params = NULL,
fixed = NULL, method = BFGS, verbose = F)

Here what exactly the eps refers to ? It would be really useful if somebody
can suggest me the meaning.

With regards,
Upananda

-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


Re: [R] creating a loop for a function

2011-10-06 Thread upananda pani
Respected Sir,

I am grateful to you for helping me out. Earlier i used to directly the
formula without calling for statstic, parameter or p-value. As i am learning
R first time, i can see how deep i have to go to learn it.

With regards,
Upananda


On Fri, Oct 7, 2011 at 12:00 AM, R. Michael Weylandt 
michael.weyla...@gmail.com wrote:

 Well you said you wanted statistics from the test, but you didn't say
 which statistics you wanted: any of the following would work:

 sapply(1:10, function(i) Box.test (lfut, lag = i, type=Ljung)$statistic)
 sapply(1:10, function(i) Box.test (lfut, lag = i, type=Ljung)$parameter)
 sapply(1:10, function(i) Box.test (lfut, lag = i, type=Ljung)$p.value)

 extractor wasn't quite the right word, but more or less that's the
 idea (if you happen to know it from other programming contexts).

 Michael


 On Thu, Oct 6, 2011 at 1:43 AM, upananda pani upananda.p...@gmail.com
 wrote:
  Respected Sir,
  I am grateful to you for your reply. This is working perfectly fine. I do
  not know how to add extractors. Please give me one example with this
  function.
  With regards,
  Upananda
 
  On Thu, Oct 6, 2011 at 1:04 AM, R. Michael Weylandt
  michael.weyla...@gmail.com wrote:
 
  lapply(1:10, function(i) Box.test (lfut, lag = i, type=Ljung))
 
  Add extractors to get statistics as desired.
 
  Michael Weylandt
 
  On Wed, Oct 5, 2011 at 1:09 PM, upananda pani upananda.p...@gmail.com
  wrote:
   Dear All,
  
   I want to create a loop within a function r. The example follows:
  
   Box.test (lfut, lag = 1, type=Ljung)
  
   if i want to compute the Box.test for lag 1 to 10, I have to write
   manually
change each time for different lag. So i wan to write a loop for the
   lag 1
   to 10 and return the statistics for each lag. Is there any method to
 do
   this
   ?
  
   With regards,
   Upananda
  
   --
  
  
   You may delay, but time will not.
  
  
   Research Scholar
   alternative mail id: up...@iitkgp.ac.in
   Department of HSS, IIT KGP
   KGP
  
  [[alternative HTML version deleted]]
  
   __
   R-help@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.
  
 
 
 
  --
 
 
  You may delay, but time will not.
 
 
  Research Scholar
  alternative mail id: up...@iitkgp.ac.in
  Department of HSS, IIT KGP
  KGP
 
 




-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


[R] creating a loop for a function

2011-10-05 Thread upananda pani
Dear All,

I want to create a loop within a function r. The example follows:

Box.test (lfut, lag = 1, type=Ljung)

if i want to compute the Box.test for lag 1 to 10, I have to write manually
 change each time for different lag. So i wan to write a loop for the lag 1
to 10 and return the statistics for each lag. Is there any method to do this
?

With regards,
Upananda

-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


[R] regarding specifying criteria for Cointegration

2011-10-02 Thread upananda pani
Dear All,

I am learning R and Time Series Econometrics for the first time. I have
doubt regarding cointegration specification criteria. The problem follows:

test1 - ca.jo(data1,ecdet=const,type=trace,K=2,spec=transitory)---When
to specify transitory
test1 - ca.jo(data1,ecdet=const,type=trace,K=2,spec=longrun)..when to
specify long-run

With regards,
Upananda

[[alternative HTML version deleted]]

__
R-help@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.


[R] checking the outliers of the time series data set

2011-09-29 Thread upananda pani
Dear All,

Can you please guide me how to check the outliers in the data set in R. It
would be great if you can give some examples of methods.

With regards,
Upananda

-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.


[R] cointegration test

2011-09-28 Thread upananda pani
Dear All,

I am looking for a cointegration relationship between Spot and Future Price
of commodites. The problem i am facing follows:

1. After estimating by Engle-Grranger Method, i found that the residuals are
stationary at their level I (o), which is required to fulfill the
cointegration test. But the autocorrelation problem arises, as DW statistics
is signficantly low 0.50-0.88 for various commodities. My question is shall
i go ahead with the results or not.

2. When i use Johansens Method i found at least one cointegrtion relation.
But i am confused with lag selection criteria. I use VAR to select the
lagselection criteria. But there is autocorrelation problem with the lags it
is providing for AIC. Whether i should take first difference of the price
level to estimate the VAR, then how to use the same lag selection criteria,
when i am using price series in levels to estimate the cointegration by
johansen method.

Looking forward for your help

With sincere regards,
Upananda

-- 


You may delay, but time will not.


Research Scholar
alternative mail id: up...@iitkgp.ac.in
Department of HSS, IIT KGP
KGP

[[alternative HTML version deleted]]

__
R-help@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.