Displaying 20 results from an estimated 10000 matches similar to: "a quick question about the package "car"?"
2024 Oct 04
3
apply
OK. Thanks to all. Suppose I have two vectors, x and y. Is there a way
to do the covariance matrix with ?apply?. The matrix I need really
contains the deviation products divided by the degrees of freedom (n-1).
That is, the elements
(1,1), (1,2),...,(1,n)
(2,1), (2,2),...., (2,n)
....
(n,1),(n,2),...,(n,n).
> Hello,
>
> This doesn't make sense, if you have only one vector you
2024 Oct 04
1
apply
It's still hard to figure out what you want. If you have two vectors
you can compute their (2x2) covariance matrix using cov(cbind(x,y)).
If you want to compute all pairwise squared differences between elements
of x and y you could use outer(x, y, "-")^2.
Can you explain a little bit more about (1) the context for your
question and (2) why you want/need to use apply() ?
On
2024 Oct 04
1
apply
Hello,
This doesn't make sense, if you have only one vector you can estimate
its variance with
var(x)
but there is no covariance, the joint variance of two rv's. "co" or
joint with what if you have only x?
Note that the variance of x[1] or any other vector element is zero, it's
only one value therefore it does not vary. A similar reasonong can be
applied to cov(x[1],
2024 Oct 04
2
apply
Hello
I have a vector:
set.seed(123) > n<-3 > x<-rnorm(n); x [1] -0.56047565 -0.23017749
1.55870831 I like to create a matrix with elements containing variances
and covariances of x. That is var(x[1]) cov(x[1],x[2]) cov(x[1],x[3])
cov(x[2],x[1]) var(x[2]) cov(x[2],x[3]) cov(x[3],x[1]) cov(x[3],x[2])
var(x[3]) And I like to do it with "apply". Thanks.
On 10/4/2024 6:35
2024 Oct 04
1
apply
Hello,
If you have a numeric matrix or data.frame, try something like
cov(mtcars)
Hope this helps,
Rui Barradas
?s 10:15 de 04/10/2024, Steven Yen escreveu:
> On 10/4/2024 5:13 PM, Steven Yen wrote:
>
>> Pardon me!!!
>>
>> What makes you think this is a homework question? You are not
>> obligated to respond if the question is not intelligent enough for you.
2017 Jun 01
0
Problem of a function I wrote
Hello everyone,
It seems that I was not successfully attached the code. Here is the
code. I appreciate any help!
Best,
Yen
?? b88207001 at ntu.edu.tw:
> Hello everyone,
>
> I have been working on a code which simply repeatedly appends a
> number into a vector and write a file. However, it could not be
> properly implemented when I use it. It works when I run it line by
2020 Oct 08
0
unable to access index for repository...
All support on this list is voluntary, and support for old versions of R is not even necessarily on-topic here which is why you keep getting nudged to upgrade. Your "need" for support for an old version is definitely not "our" problem, so I suggest you start looking for a consultant if this issue is that important to you. Such is the nature of volunteer-developed open source
2020 Oct 08
2
unable to access index for repository...
Thanks for the help. I have a reason to continue with R-3.0.3. I used
maxLik to estimate econometric models and some of them are better
handled with R-3.0.3 (but not later)----a sad reality I do not like.
Here is what I did. I downloaded
https://cran-archive.r-project.org/bin/windows/contrib/3.0/aod_1.3.zip
and installed the zip file, which worked in both RStudio and R (without
RStudio).
In
2024 Oct 04
1
apply
On 10/4/2024 5:13 PM, Steven Yen wrote:
> Pardon me!!!
>
> What makes you think this is a homework question? You are not
> obligated to respond if the question is not intelligent enough for you.
>
> I did the following: two ways to calculate a covariance matrix but
> wonder how I might replicate the results with "apply". I am not too
> comfortable with the
2020 Oct 08
0
unable to access index for repository...
Don't choose a mirror. That will override the repos choice.
Do update R to a current version if you aren't able to debug this
yourself.
Duncan Murdoch
On 08/10/2020 12:38 p.m., Steven Yen wrote:
> Sorry Gentlemen and all. Now this is becoming a joke (to me). I repeated
> what I did earlier, with and without the option to set repos suggested
> by Duncan. Now it does not work.
2024 Aug 11
3
Printing
Thanks. Will try it.
Have not tried it but I think the following may work:
out$results<-NULL
out$results$ei<-ap
out$results$vi<-vap
All I need is printing by returning out (unless I turn it off). And,
retrieve ap and vap as needed as shown above. Guess I need to read more
about invisible.
On 8/11/2024 10:09 PM, Rui Barradas wrote:
> ?s 09:51 de 11/08/2024, Steven Yen escreveu:
2017 Jun 01
2
Problem of a function I wrote
Hello everyone,
I have been working on a code which simply repeatedly appends a number
into a vector and write a file. However, it could not be properly
implemented when I use it. It works when I run it line by line. I
wonder what is the problem and I appreciate anyone who is willing to
help.
The function and the example code is attached. Any advice is appreciated!
Best,
Yen
2024 Jul 12
1
grep
Could not get "which" to work, but my grep worked. Thanks.
> which(grep("very|somewhat",names(goprobit.p$est))) Error in
which(grep("very|somewhat", names(goprobit.p$est))) : argument to
'which' is not logical > grep("very|somewhat",names(goprobit.p$est)) [1]
6 7 8 9 10 11 12 13 28 29 30 31 32 33 34 35 50 51 52 53 54 55 56 57
On 7/12/2024
2020 Oct 08
2
unable to access index for repository...
Sorry Gentlemen and all. Now this is becoming a joke (to me). I repeated
what I did earlier, with and without the option to set repos suggested
by Duncan. Now it does not work. I wonder whether it is dependent on the
mirror I chose, but I do not remember the one I chose earlier when it work.
I need your help, gentlemen, as I need to use R-3.0.3 for my task.
>
2020 Oct 08
0
unable to access index for repository...
Okay, so it's not an RStudio issue. However, I'd guess setting
options(repos = "https://cran-archive.r-project.org")
at the start of your session could make everything work. (I'm guessing
you currently have it set to "http://cran.rstudio.com", which is the
source of the last warning below, probably due to an R bug. But since
you're using an obsolete
2010 Jun 15
3
Problem about zero
Hello, everyone,
There's a problem about zero in R and I really need your help.
I have a vector shown as x=c(0.1819711,0.4811463,0.1935151,0.1433675),
The sum of this vector is shown as 1 in R, but when I type 1-sum(x), the
value is not zero, but -2.220446e-16.
I can accept that this value is quite small and could be seen as zero, but
there would be a problem when it's not really
2006 Jan 09
2
warning message from nlme
Hi all,
I tried to do a variance components using nlme, but I got the following
warning mesage
#####################################################
not meaningful for factors in: Ops.factor(y[revOrder], Fitted)
######################################################
Can someone point out what is the meaning of this warning message? I
tried to look at Ops.factor, but I don't
2006 Jan 05
1
convert matrix to data frame
Hi all,
Suppose I have a 4 x 2 matrix A and I want to select the values in
second column such that the value in first column equals to k.
I gave the colnames as alpha beta, so I was trying to access the info
using
A$beta[A[,1]==k], however, I was told it's not a data frame, I can get
the object by using dollar sign. I tried data.frame(A), but it didn't
work.
Any input
2017 Jun 01
1
Problem of a function I wrote
Hello everyone,
I know where is wrong. I forget to specify the parameters in my
function. Thank you for anyone who was trying to help me!
Best,
Yen
?? b88207001 at ntu.edu.tw:
> Hello everyone,
>
> It seems that I was not successfully attached the code. Here is the
> code. I appreciate any help!
>
> Best,
> Yen
>
> ?? b88207001 at ntu.edu.tw:
>
>> Hello
2020 Oct 08
2
unable to access index for repository...
Thanks. You gentlemen please tell me what this means. In R (outside of
RStudio) I ran:
install.packages("aod")
Received a warning (and installation did not seem to go through).
Then I tried
install.packages("aod",repos='https://cran-archive.r-project.org')
Received a warning but it went on to try