Displaying 20 results from an estimated 10000 matches similar to: "possible bug in sd"
2004 Mar 18
0
sd(): why error with NA's?
R 1.8.1 with Windows XP.
I have a question about how sd() behaves with NA's:
> mean(c(1,2,3,NA))
[1] NA
> median(c(1,2,3,NA))
[1] NA
> mad(c(1,2,3,NA))
[1] NA
> sd(c(1,2,3,NA))
Error in var(x, na.rm = na.rm) : missing observations in cov/cor
>
What is so special about the standard deviation, relative to
other descriptive statistics, that the presence of NA's
deserves an
2002 Sep 17
0
ga: genetic algorithms package
Dear all,
at the following address
http://linaria.dst.unive.it/~claudio/R/Rmaterial.html#ga
you can download a package to build simple genetic algorithms. I wrote
this package to introduce genetic algorithms to student in labs, which
means, the package emphasize "how a ga works" instead of "how
fast it could be".
Please, let me know any comments or suggestions,
Bests,
2003 Jan 29
3
na.rm in sd()
Hello, I think this qualify as a bug
> x<-c(1,2,3,4,NA,6,7)
> mean(x)
[1] NA
> mean(x,na.rm=T)
[1] 3.833333
> sd(x)
Error in var(as.vector(x)) : missing observations in cov/cor
> sd(x,na.rm=T)
Error in sd(x, na.rm = T) : unused argument(s) (na.rm ...)
> var(x)
Error in var(x) : missing observations in cov/cor
> var(x,na.rm=T)
[1] 5.366667
>
why sd() does not
2008 May 16
1
var/sd and NAs in R2.7.0
Hello all,
I just upgraded to R 2.7.0 and found that the behavior of 'var' and 'sd'
have changed in the presence NAs (this wasn't explicit in the NEWS file,
though I see it probably has to do with the change for cor/cov). Anyway,
I just want to make sure that it was intentional to produce an error
when there was all NAs and na.rm=TRUE, rather than returning an NA (like
R
2003 Dec 23
0
circular package
Dear All,
Ulric Lund and me are developing a new package called 'circular' that as
soon as possible will substitute 'CircStats' package.
A pre-released is available at:
http://www.dst.unive.it/~claudio/R/circular_0.1.tar.gz
I kindly ask everybody is using CircStats to check this new package
and send me comments, suggestions and bugs to claudio at unive.it and not to
the list.
As
2003 Dec 23
0
circular package
Dear All,
Ulric Lund and me are developing a new package called 'circular' that as
soon as possible will substitute 'CircStats' package.
A pre-released is available at:
http://www.dst.unive.it/~claudio/R/circular_0.1.tar.gz
I kindly ask everybody is using CircStats to check this new package
and send me comments, suggestions and bugs to claudio at unive.it and not to
the list.
As
2013 Jan 13
1
Loading circular package from Rprofile.site
Hi,
I installed "circular" package and I wanted to load it automatically
when R starts up, so I added the following lines in file
Rprofile.site,
.First <- function()
library(circular)
When R starts up, it gives me the following error:
----------
Loading required package: boot
Loading required package: graphics
Loading required package: stats
Error : .onAttach failed in
2007 Dec 02
1
sd(NA)
Dear Prof. Ripley
I noted a change in the behaviour of "cov", which is very reasonable:
## R version 2.7.0 Under development (unstable) (2007-11-30 r43565)
> cov(as.numeric(NA), as.numeric(NA), use="complete.obs")
Error in cov(as.numeric(NA), as.numeric(NA), use = "complete.obs") :
no complete element pairs
whereas earlier behavior was, for example:
## R
2005 Oct 31
3
Still a bug with NA in sd() or var()?
Dear R-users,
Running R 2.1.1 in WindowsXP, there seems to be a 'bug' in sd()
If
>x<-c(1,2,3,NA,5)
>mean(x)
[1] NA
But
>sd(x)
Or
>var(x)
give
Error in var(x, na.rm = na.rm) : missing observations in cov/cor
There are obvious work-rounds, like
>sd(x, is.na(x)==F)
which gives the result (with error message)
[1] 1.707825
Warning message:
the condition has length > 1
2007 Dec 03
1
cor(data.frame) infelicities
In using cor(data.frame), it is annoying that you have to explicitly
filter out non-numeric columns, and when you don't, the error message
is misleading:
> cor(iris)
Error in cor(iris) : missing observations in cov/cor
In addition: Warning message:
In cor(iris) : NAs introduced by coercion
It would be nicer if stats:::cor() did the equivalent *itself* of the
following for a data.frame:
2008 Mar 25
1
Error propagation
Dear R-helpers,
I´m in the context of writing a general function for error propagation
in R.
There are somehow a few questions I would like to ask (discuss), as my
statistical knowledge is somewhat restricted.
Below is the function I wrote, the questions are marked.
Many thanks in advance.
propagate <- function(expr, varList, type = c("stat", "raw"), cov =
TRUE)
{
2006 Jan 13
1
Variance-covariance by factor
Dear all,
I have a data frame with one factor and four numeric variables and
wish to obtain the var-cor matrix separately by factor. I tried by() and
sapply() but getting nowhere. I understand this can be done by subsetting
the dataframe, but there should have some sleek ways of doing it.
Here is a simulated dataframe;
s <- rep(c("A","B","C"), c(25,22,18))
d
2004 Jan 21
1
outlier identification: is there a redundancy-invariant substitution for mahalanobis distances?
Dear R-experts,
Searching the help archives I found a recommendation to do multivariate
outlier identification by mahalanobis distances based on a robustly estimated
covariance matrix and compare the resulting distances to a chi^2-distribution
with p (number of your variables) degrees of freedom. I understand that
compared to euclidean distances this has the advantage of being scale-invariant.
2008 Apr 05
2
pearson's correlation
Hello,
I used the function cor to calculate the pearson correlation coefficient between variables. However, the resulting values do not correspond to the outcome of my excel-calculations, for which I used the formula Cor(x,y)=Cov(x,y)/(SD(x)*SD(y))
So my question is: How does the function "cor" compute the pearson correlation coefficient?
Thank you in advance,
Ake Nauta
2007 Mar 16
1
ideas to speed up code: converting a matrix of integers to a matrix of normally distributed values
Hi all,
[this is a bit hard to describe, so if my initial description is
confusing, please try running my code below]
#WHAT I'M TRYING TO DO
I'd appreciate any help in trying to speed up some code. I've written
a script that converts a matrix of integers (usually between 1-10,000
- these represent allele names) into two new matrices of normally
distributed values (representing
2006 Sep 25
0
Sampling distribution of correlation estimations derived from robust MCD and MVE methods
Dear R users,
I am trying to use MCD and MVE methods in the analysis of functional imaging
(fMRI) data. But, before doing that, I want to understand the sampling
distribution of the correlation parameter given by MCD and MVE (cov.mcd$cor,
cov.mve$cor).
To this end, I conducted a simulation where in each of 100000 epochs, I
a. construct a matrix from two vectors, each containing 40 numbers
2006 Sep 25
0
[PlainText Attempt] Sampling distribution of correlation estimations derived from robust MCD and MVE methods
Dear R users,
I am trying to use MCD and MVE methods in the analysis of functional imaging
(fMRI) data. But, before doing that, I want to understand the sampling
distribution of the correlation parameter given by MCD and MVE (cov.mcd$cor,
cov.mve$cor).
To this end, I conducted a simulation where in each of 100000 epochs, I
a. construct a matrix from two vectors, each containing 40 numbers
2002 Oct 18
4
code to turn T into TRUE
Does anyone have code that will methodically process R sourcecode, turning
T's into TRUE and F's into FALSE? I got bored doing this by hand, after the
first 30-odd functions-- there are hundreds left to do. I don't want to
simply deparse everything, because that would destroy my beautiful
formatting.
The reason it's not trivial, is that comment lines, quotes, and split lines
need
2003 Jan 04
0
factor analysis (pca): how to get the 'communal
On 4 Jan 2003 at 12:51, Wolfgang Lindner wrote:
> Please excuse me, if the following questions are *too* off-topic, but I found it
> interesting. In inspecting your code I came across an R feature, I could not
> find in the online manuals:
>
> Q1. Looking at the left-handside in your function def:
>
> "cov.cor" <- function ( covmat ) {
>
2007 Feb 22
0
Error in solve.default
I am trying to run the following function (a hierarchical bayes linear
model) and receive the error in solve.default. The function was
originally written for an older version of SPlus. Can anyone give me some
insights into where the problem is?
Thanks
R 2.4.1 on MAC OSX 2mb ram
Mark Grant
markg at uic.edu
> attach(Aspirin.frame)
> hblm(Diff ~ 1, s = SE)
Error in solve.default(R, rinv)