Re: [R] Expanding a VCV Matrix

2011-04-21 Thread Maithula Chandrashekhar
Oh.you are right.sorry. So many work nowadays, even
cant see things properly.

Anyways thanks for your input.

2011/4/21 Uwe Ligges :
>
>
> On 21.04.2011 17:08, Maithula Chandrashekhar wrote:
>>
>> Thanks Uwe for your insight. However this could not solve my problem.
>> Actually, I meant to define 'Str' in this way:
>>
>>> mat<- matrix(c(1,2,0,2,5,0.5,0,0.5,3), 3, 3)
>>> colnames(mat)<- rownames(mat)<- paste("variable", 1:3, sep="")
>>> mat
>>
>>           variable1 variable2 variable3
>> variable1         1       2.0       0.0
>> variable2         2       5.0       0.5
>> variable3         0       0.5       3.0
>>>
>>> Str<- c(paste("variable", 1:4, sep=""), "variable2"); Str
>>
>> [1] "variable1" "variable2" "variable3" "variable4" "variable2"
>>
>> Therefore 'variable2' should appear twice in my modified VCV matrix,
>> which was not there in your suggestion. Is there any better any on how
>> can I do that? or it is really imposable to achieve?
>
> It is there twice if the strings and the rownames match.
>
> Uwe
>
>
>>
>> Thanks,
>>
>> 2011/4/21 Uwe Ligges:
>>>
>>>
>>> On 20.04.2011 19:26, Maithula Chandrashekhar wrote:
>>>>
>>>> Dear all, I have special task to expand a given VCV matrix, however
>>>> could not accomplice yet. Let say I have following VCV matrix
>>>>
>>>>> mat<- matrix(c(1,2,0,2,5,0.5,0,0.5,3), 3, 3)
>>>>> colnames(mat)<- rownames(mat)<- paste("variable", 1:3)
>>>>> mat
>>>>
>>>>            variable 1 variable 2 variable 3
>>>> variable 1          1        2.0        0.0
>>>> variable 2          2        5.0        0.5
>>>> variable 3          0        0.5        3.0
>>>>
>>>> Now, say I have a general string vector like this:
>>>>
>>>>> Str<- c(paste("variable", 1:4), "variable2")
>>>>> Str
>>>>
>>>> [1] "variable 1" "variable 2" "variable 3" "variable 4" "variable 2"
>>>
>>>
>>>
>>> If Str is like the printed one above rather than the code example, you
>>> can
>>> do:
>>>
>>>  mat[Str[Str %in% rownames(mat)], Str[Str %in% colnames(mat)]]
>>>
>>> Uwe Ligges
>>>
>>>
>>>
>>>
>>>> Now according to this string, I want my previous VCV matrix also
>>>> expands. Therefore, as "variable 4" is not there in VCV matrix, so it
>>>> will be ignored. Therefore final VCV matrix will be of order 4, and
>>>> will look like:
>>>>
>>>>        variable 1      variable 2      variable 3      variable 2
>>>> variable 1      1       2       0       2
>>>> variable 2      2       5       0.5     5
>>>> variable 3      0       0.5     3       0.5
>>>> variable 2      2       5       0.5     5
>>>>
>>>> However, I do not think it is just some straightforward expansion,
>>>> which could be done just by the subsetting mechanism of R. Is there
>>>> any idea on how can I do it for general case?
>>>>
>>>> Thanks for your time,
>>>>
>>>> __
>>>> 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-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] Expanding a VCV Matrix

2011-04-21 Thread Maithula Chandrashekhar
Thanks Uwe for your insight. However this could not solve my problem.
Actually, I meant to define 'Str' in this way:

> mat  <- matrix(c(1,2,0,2,5,0.5,0,0.5,3), 3, 3)
> colnames(mat) <- rownames(mat) <- paste("variable", 1:3, sep="")
> mat
  variable1 variable2 variable3
variable1 1   2.0   0.0
variable2 2   5.0   0.5
variable3 0   0.5   3.0
>
> Str<- c(paste("variable", 1:4, sep=""), "variable2"); Str
[1] "variable1" "variable2" "variable3" "variable4" "variable2"

Therefore 'variable2' should appear twice in my modified VCV matrix,
which was not there in your suggestion. Is there any better any on how
can I do that? or it is really imposable to achieve?

Thanks,

2011/4/21 Uwe Ligges :
>
>
> On 20.04.2011 19:26, Maithula Chandrashekhar wrote:
>>
>> Dear all, I have special task to expand a given VCV matrix, however
>> could not accomplice yet. Let say I have following VCV matrix
>>
>>> mat<- matrix(c(1,2,0,2,5,0.5,0,0.5,3), 3, 3)
>>> colnames(mat)<- rownames(mat)<- paste("variable", 1:3)
>>> mat
>>
>>            variable 1 variable 2 variable 3
>> variable 1          1        2.0        0.0
>> variable 2          2        5.0        0.5
>> variable 3          0        0.5        3.0
>>
>> Now, say I have a general string vector like this:
>>
>>> Str<- c(paste("variable", 1:4), "variable2")
>>> Str
>>
>> [1] "variable 1" "variable 2" "variable 3" "variable 4" "variable 2"
>
>
>
> If Str is like the printed one above rather than the code example, you can
> do:
>
>  mat[Str[Str %in% rownames(mat)], Str[Str %in% colnames(mat)]]
>
> Uwe Ligges
>
>
>
>
>> Now according to this string, I want my previous VCV matrix also
>> expands. Therefore, as "variable 4" is not there in VCV matrix, so it
>> will be ignored. Therefore final VCV matrix will be of order 4, and
>> will look like:
>>
>>        variable 1      variable 2      variable 3      variable 2
>> variable 1      1       2       0       2
>> variable 2      2       5       0.5     5
>> variable 3      0       0.5     3       0.5
>> variable 2      2       5       0.5     5
>>
>> However, I do not think it is just some straightforward expansion,
>> which could be done just by the subsetting mechanism of R. Is there
>> any idea on how can I do it for general case?
>>
>> Thanks for your time,
>>
>> __
>> 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-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] Expanding a VCV Matrix

2011-04-20 Thread Maithula Chandrashekhar
Dear all, I have special task to expand a given VCV matrix, however
could not accomplice yet. Let say I have following VCV matrix

> mat  <- matrix(c(1,2,0,2,5,0.5,0,0.5,3), 3, 3)
> colnames(mat) <- rownames(mat) <- paste("variable", 1:3)
> mat
   variable 1 variable 2 variable 3
variable 1  12.00.0
variable 2  25.00.5
variable 3  00.53.0

Now, say I have a general string vector like this:

> Str <- c(paste("variable", 1:4), "variable2")
> Str
[1] "variable 1" "variable 2" "variable 3" "variable 4" "variable 2"

Now according to this string, I want my previous VCV matrix also
expands. Therefore, as "variable 4" is not there in VCV matrix, so it
will be ignored. Therefore final VCV matrix will be of order 4, and
will look like:

variable 1  variable 2  variable 3  variable 2
variable 1  1   2   0   2
variable 2  2   5   0.5 5
variable 3  0   0.5 3   0.5
variable 2  2   5   0.5 5

However, I do not think it is just some straightforward expansion,
which could be done just by the subsetting mechanism of R. Is there
any idea on how can I do it for general case?

Thanks for your time,

__
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] A Math question

2011-02-13 Thread Maithula Chandrashekhar
Dear all, I admit this is not anything to do R and even with
Statistics perhaps. Strictly speaking this is a math related question.
However I have some reasonable feeling that experts here would come up
with some elegant suggestion to my question.

Here my question is: What is sum of all Integers? I somewhere heard
that it is Zero as positive and negative integers will just cancel
each other out. However want to know is it correct?

Thanks so much

__
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] I want to ask user to create a typical matrix, otherwise there should be some error displaying...

2011-02-03 Thread Maithula Chandrashekhar
Dear all, I am into some bigger project and in implementing that, I
have come across a problem, wherein I have to ask user to create a
Matrix with all elements either NA value or some "Date" object,
preferably in mm/dd/yy format. Therefore I would like to force user to
create following sort of matrix, otherwise there should be some error
displaying:

userMatrix = matrix(NA, 4, 6)
userMatrix[1,2] = userMatrix[4,3] = userMatrix[2,6] = as.Date("2011-01-03")

Can somebody give me some hint on how to accomplish above task?

Thanks for your time.

__
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] List of all times zones in R

2011-01-30 Thread Maithula Chandrashekhar
Hi all, in R I have Sys.timezone() function to get the current working
Time zone. However I want to have a vector to get the list of all
available time zones, like say, LETTERS gives me all letters. Is there
any function like that?

Thanks in advance,

__
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] A question on Statistics

2010-12-26 Thread Maithula Chandrashekhar
I am not a pure Statistics background and therefore please forgive me if
this question (which is not R related either) is too trivial.

In many Statistics literature I find following statement: "restrictions in
different coefficients matrices have to be imposed to ensure uniqueness of
the parametrization". Can somebody tell me what is the meaning of Uniqueness
in the parametrization? Does it mean that, two different coefficient
matrices may give exactly the same result, and therefore coefficient matrix
is not unique?

I find there are many members (perhaps all) in this forum who are really
masters in Statistics. Therefore I hope somebody will clarify me with the
intuition behind that.

Thanks,

[[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] Fetching data

2010-11-14 Thread Maithula Chandrashekhar
Dear all R users, I am wondering is there any procedure exists on R to fetch
data directly from "http://www.ncdex.com/Market_Data/Spot_price.aspx"; and
save it in some time series object, without filling any field in that
website.

Can somebody point me whether it is possible?

Thanks and regards,

[[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.