Hi again,
I have just learned that twobin is a function written by the author of the
code I'm trying to translate, so I have to look elsewhere for the solution.
Thanks for your time!
Ulf
__
R-help@stat.math.ethz.ch mailing list
I use the EM algorithm to treat missing values. I don't know anything
about your contextual use nor much about the details of the EM alg for
that matter, but the norm package may be of help. (prelim.norm() and
em.norm() functions being useful)
These of course assume normality.
On 4/4/06, Marco
Dear R-gurus!
Is it possible within boxplot to break the y-scale into two (or
anything)? I'd like to have a normal linear y-range from 0-10 and the
next tick mark starting at, say 60 and continue to 90. The reason is for
better visualising the outliers.
All the best,
Kare
[[alternative
Hello ,
I am very new to R and I tried to find some solutions to my problem in
the mail archives, but I couldnt.
All I need to do is read a data file, which has data in X Y Z format
and then I want to plot a surface plot or a contour plot of this.
my data is like ..
1710 0.626938723432
Hello ,
I am very new to R and I tried to find some solutions to my problem in
the mail archives, but I couldnt.
All I need to do is read a data file, which has data in X Y Z format
and then I want to plot a surface plot or a contour plot of this.
my data is like ..
1710 0.626938723432
Hi
I am trying to use lapply with a function that requires two list type
variables but I cannot find a way to program it and could not find any hints
under lapply or searching the R-list. As an example I have used the
mahalanobis function with the iris data. Is there a way to replace the for
loop
you could use mapply(), e.g.,
mapply(mahalanobis, center = centroids, cov = cov.mat, MoreArgs =
list(x = test))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35,
Hi
what is the best way to calculate the trace of a product
of two matrices?
If
A - matrix(rnorm(48),nrow=6)
B - matrix(rnorm(48),nrow=8)
Is there a better (faster, more elegant) way to compute the trace of
A%*%B than
sum(diag(A %*% B))?
I would call the above solution inelegant
Try
sum( rowSums( A * t(B)) )
Then you do not make any calculation you do not really need.
Carlos J. Gil Bellosta
http://www.datanalytics.com
Quoting Robin Hankin [EMAIL PROTECTED]:
Hi
what is the best way to calculate the trace of a product
of two matrices?
If
A -
It is still better to do
sum( A * t(B) )
Sorry!!
Carlos J. Gil Bellosta
http://www.datanalytics.com
Quoting Robin Hankin [EMAIL PROTECTED]:
Hi
what is the best way to calculate the trace of a product
of two matrices?
If
A - matrix(rnorm(48),nrow=6)
B - matrix(rnorm(48),nrow=8)
Is
Hi
On 5 Apr 2006 at 10:44, Abhinav Verma wrote:
Date sent: Wed, 5 Apr 2006 10:44:41 +0200
From: Abhinav Verma [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Subject:[R] Reading xyz data from a file and plotting a contour
plot
BTW. I checked help page of contour and maybe it could mention a note
about akima package or interp function.
Petr
--- Forwarded message follows ---
From: Petr Pikal [EMAIL PROTECTED]
To: Abhinav Verma [EMAIL PROTECTED],
r-help@stat.math.ethz.ch
Hello,
I have this data frame:
### begin
d -data.frame(matrix(c(1,--,bla,2),2,2))
d
# I want to replace the -- by \N and still get a data frame.
# I tried:
out -gsub(--,N,as.matrix(d)) #using as.matrix to get rid of factors
out
cat(out)
# But I lost my data frame
### end
Any idea?
How about ;
m - matrix(rnorm(9), ncol = 3)
mm - matrix(rnorm(9), ncol = 3)
sum(sapply(1:3, function(i, m, mm) m[i, ] %*% mm[ ,i], m, mm))
**
what is the best way to calculate the trace of a product
of two matrices?
If
A - matrix(rnorm(48),nrow=6)
B -
Hi
On 5 Apr 2006 at 7:48, Lapointe, Pierre wrote:
From: Lapointe, Pierre [EMAIL PROTECTED]
To: 'r-help@stat.math.ethz.ch' r-help@stat.math.ethz.ch
Date sent: Wed, 5 Apr 2006 07:48:33 -0400
Subject:[R] gsub in data frame
Hello,
Hi,
this is probably the easiest thing to do but I manage
not finding the answer:
I have a list with matrices of exact same format and
headers. Now I would like to transform the list into
an normal array. What is the proper way to do this?
as.array changes the entire format and right now I
only
probably you're looking for either
do.call(rbind, lis)
or
do.call(cbind, lis)
where 'lis' is your list.
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35, Leuven,
Please supply some test data and the expected answer
since its not clear what is desired here.
On 4/5/06, Werner Wernersen [EMAIL PROTECTED] wrote:
Hi,
this is probably the easiest thing to do but I manage
not finding the answer:
I have a list with matrices of exact same format and
headers.
Hello Petr,
Thanks a lot for the reply, it works..
cheers,
Abhi.
On 4/5/06, Petr Pikal [EMAIL PROTECTED] wrote:
Hi
On 5 Apr 2006 at 10:44, Abhinav Verma wrote:
Date sent: Wed, 5 Apr 2006 10:44:41 +0200
From: Abhinav Verma [EMAIL PROTECTED]
To:
Hello,
The package I'm finishing up contains a series of functions
intended to be run one after the other, as in:
do data-prep using A()
run complicated, slow, analysis B()
do complicated, slow additional analysis C()
plot the results with D() and E()
Now, in the documentation for each of those
On Wed, 5 Apr 2006, Petr Pikal wrote:
BTW. I checked help page of contour and maybe it could mention a note
about akima package or interp function.
We don't generally link from standard packages to contributed ones. In
this case, there is a long history of unreliability of the R version of
Werner Wernersen pensterfuzzer at yahoo.de writes:
Hi,
this is probably the easiest thing to do but I manage
not finding the answer:
I have a list with matrices of exact same format and
headers. Now I would like to transform the list into
an normal array. What is the proper way to do
Sarah Goslee wrote:
Hello,
The package I'm finishing up contains a series of functions
intended to be run one after the other, as in:
do data-prep using A()
run complicated, slow, analysis B()
do complicated, slow additional analysis C()
plot the results with D() and E()
Now, in the
On Wed, 5 Apr 2006, Sarah Goslee wrote:
Hello,
The package I'm finishing up contains a series of functions
intended to be run one after the other, as in:
do data-prep using A()
run complicated, slow, analysis B()
do complicated, slow additional analysis C()
plot the results with D() and
On Wed, 5 Apr 2006, Lapointe, Pierre wrote:
Hello,
I have this data frame:
### begin
d -data.frame(matrix(c(1,--,bla,2),2,2))
d
So d is a two-column data frame with factor columns.
# I want to replace the -- by \N and still get a data frame.
levels(d$X1) - gsub(--,N, levels(d$X1))
On 4/5/06, Ben Bolker [EMAIL PROTECTED] wrote:
Werner Wernersen pensterfuzzer at yahoo.de writes:
Hi,
this is probably the easiest thing to do but I manage
not finding the answer:
I have a list with matrices of exact same format and
headers. Now I would like to transform the list
On 4/5/06, Uwe Ligges [EMAIL PROTECTED] wrote:
Sarah Goslee wrote:
Hello,
The package I'm finishing up contains a series of functions
intended to be run one after the other, as in:
do data-prep using A()
run complicated, slow, analysis B()
do complicated, slow additional analysis
I am attempting to value convertible bonds through a Monte Carlo approach.
I want to express call schedules as date-price tuples. Naturally, these
tuples need to be expanded to match the frequency of the innovations in the
MC process.
1. Is there a straigh-forward way to accomplish this
Oh yes, I should give an example:
m - matrix(1:6,nrow=3)
L - list(m,m)
Output of L:
[[1]]
[,1] [,2]
[1,]14
[2,]25
[3,]36
[[2]]
[,1] [,2]
[1,]14
[2,]25
[3,]36
I would like to transform L to and array looking like
this:
, , 1
[,1]
On 4/5/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
On 4/5/06, Uwe Ligges [EMAIL PROTECTED] wrote:
What about an additional help page that relates to the whole package
rather than to a single function and contains the examples? Each
function's help page can point with a \link{} to
then maybe this is what you're looking for:
L - list(matrix(rnorm(6), nrow = 3), matrix(rnorm(6), nrow = 3))
L
array(unlist(L), dim = c(nrow(L[[1]]), ncol(L[[1]]), length(L)))
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Which can be written:
array(unlist(L), dim = c(dim(L[[1]]), length(L)))
On 4/5/06, Dimitris Rizopoulos [EMAIL PROTECTED] wrote:
then maybe this is what you're looking for:
L - list(matrix(rnorm(6), nrow = 3), matrix(rnorm(6), nrow = 3))
L
array(unlist(L), dim =
On Wed, 5 Apr 2006, Sarah Goslee wrote:
Hello,
The package I'm finishing up contains a series of functions
intended to be run one after the other, as in:
do data-prep using A()
run complicated, slow, analysis B()
do complicated, slow additional analysis C()
plot the results with D() and
Another thought on checking the validity of the suggested
2*log(likelihood ratio) procedure I suggested: If it were my problem, I
think I would do some checking using Monte Carlo, e.g., as described in
sec. 2.6 of the vignette MlmSoftRev in the mlmRev package. This is
particularly
Dear R Users,
My question is overall and not necessarily related to R.
Suppose we face to a situation in which MSE( Mean Squared Error) shows
desired results but Bias shows undesired ones, Or in advers. How can we
evaluate the results. And suppose, Both MSE and Bias are important
That's great, thanks a lot! :)
Which can be written:
array(unlist(L), dim = c(dim(L[[1]]), length(L)))
On 4/5/06, Dimitris Rizopoulos
[EMAIL PROTECTED] wrote:
then maybe this is what you're looking for:
L - list(matrix(rnorm(6), nrow = 3),
matrix(rnorm(6), nrow = 3))
I upgraded from Fedora Core 4 to Fedora Core 5 and I find a lot of
previously installed packages won't run because shared libraries or
other system things have changed out from under the installed R
libraries. I do not know for sure if the R version now from
Fedora-Extras (2.2.1) is exactly the
The MSE of an estimator X for a parameter theta is defined as E(X - theta)^2,
which is equal to Var[X] + (Bias[X])^2, so in that sense, the MSE is already
taking the bias of X into account.
Hope this helps,
--
Wolfgang Viechtbauer
Department of Methodology and Statistics
University of
Hi,
having solved one problem with your kindest help I
directly ran into the next one:
I now have a 4-dimensional array and I want to
aggregate subsets (sum up over) for some of the
dimensions. This sort of aggregating works beautifully
for matrices with by(). Is there a similar function
where I
On Wed, 5 Apr 2006, Paul Johnson wrote:
I upgraded from Fedora Core 4 to Fedora Core 5 and I find a lot of
previously installed packages won't run because shared libraries or
other system things have changed out from under the installed R
libraries. I do not know for sure if the R version
Hi,
Assuming you mean the hist2d function from the gplots package,
you can save the results of the histogram as an object, and do
whatever you want with the counts.
myhist - hist2d(gps2, nbins=200)
myhist$counts # shows you the values of the counts for each bin
You can for example take the
Larry Howe [EMAIL PROTECTED] wants to:
1. read in a 2-column data file, e.g.
status tab new
db tab green
title tab Most Significant Excursions
2. end up with an R list such that I can write e.g.
lst$title
and have R return Most Significant Excursions.
I call this reading a hash table
Dear All,
I am a undergraduate using R for the first time. It seems like an excellent
program and one that I look forward to using a lot over the next few years,
but I have hit a very basic problem that I can't solve.
I want to produce a standardised histogram, i.e. one where the area under
the
I am using R for Unix and want to make some LaTeX tables. I have
already played around in R for Windows and have succeeded in making
tables that I want using the following code:
latex(Estimates, file='out.tex', rowlabel='',digits=3)
However, when I use this code in Unix, I can never find the
Hi All,
For the function bclust(e1071), the argument base.method is
explained as must be the name of a partitioning cluster function
returning a list with the same components as the return value of
'kmeans'.
In my understanding, there are three partitioning cluster functions in
R, which
On Tuesday April 4 2006 21:56, Gabor Grothendieck wrote:
Try this:
dd - read.table(myfile, as.is = TRUE)
lst - as.list(dd[,2])
names(lst) - dd[,1]
lst$title
This (almost) works. I did this instead:
p = read.delim(params.txt, as.is=T)
lst = as.list(p[ ,1])
names(lst) = rownames(p)
I know
Hi,
how did you evaluate the total area?
Here is a simple example
###
set.seed(100)
x - rnorm(100)
x.h - hist(x, freq=F, plot=F)
x.h
$breaks
[1] -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0
2.5 3.0
$counts
[1] 3 4 9 14 22 20 13 7 5 2 1
$intensities
[1] 0.0599 0.0800
Dear Marco,
I compared the maximum values with what I was expecting based on a
calculation in Excel however I've just run the set of commands to calculate
the area:
out - hist(StockReturns, probability=TRUE, plot=FALSE)
out
sum(diff(out$breaks) * out$intensities)
And it seems to have worked
Brian Quinif [EMAIL PROTECTED] writes:
I am using R for Unix and want to make some LaTeX tables. I have
already played around in R for Windows and have succeeded in making
tables that I want using the following code:
latex(Estimates, file='out.tex', rowlabel='',digits=3)
However, when I
Yes, Peter, I do mean the later() function from the Hmsic package.
Below is a reproducible example. Also, does anyone know how to stop R
from automatically running LaTeX on the file produced by latex()
library(Matching)
library(Hmisc)
#make up some data
X - matrix(rnorm(1000*5), ncol=5)
Y1 -
Dear R-help,
I'm using the R2WinBUGS package and getting an error message:
Error in file(file, r) : unable to open connection
In addition: Warning message:
cannot open file 'codaIndex.txt', reason 'No such file or
directory'
I'm using R 2.2.1 and WinBUGS 1.4.1 on a
Brian Quinif [EMAIL PROTECTED] writes:
Yes, Peter, I do mean the later() function from the Hmsic package.
Below is a reproducible example. Also, does anyone know how to stop R
from automatically running LaTeX on the file produced by latex()
The last bit is easy. It's the print method that
I seem to have straightened out the problem I was having by typing
ls -ald /home/b/bquinif/bq/9095/
before running R.
Thanks again to the ever helpful people on this list.
BQ
before you start
05 Apr 2006 23:11:12 +0200, Peter Dalgaard [EMAIL PROTECTED]:
Brian Quinif [EMAIL PROTECTED] writes:
Your command
latex(Estimates, file='out.tex', rowlabel='',digits=3)
works for me in a unix environment, and produces
the file out.tex in the current working directory.
(your second example is not reproducible, in
general, since I don't have directory named
/home/b/bquinif/bq/9095
)
Hi R users!
One thing I cannot understand with R is the frequently appearing
Correlation of coefficients. I do not find a through going explanation
of this concept either on the help pages of R or on the internet. A
Google search has shown many examples of R/S-Plus outputs but no
explanations of
Peter Dalgaard wrote:
Brian Quinif [EMAIL PROTECTED] writes:
Yes, Peter, I do mean the later() function from the Hmsic package.
Below is a reproducible example. Also, does anyone know how to stop R
from automatically running LaTeX on the file produced by latex()
The last bit is easy.
By works on the rows or first dimension. See ?by, ?apply, ?aperm
?tapply
On 4/5/06, Werner Wernersen [EMAIL PROTECTED] wrote:
Hi,
having solved one problem with your kindest help I
directly ran into the next one:
I now have a 4-dimensional array and I want to
aggregate subsets (sum up
Hi,
64bit CPUs, such as opterons, help significantly with large databases
or if you are running multiple processes. But there is a speed
penalty if you are not.
Some packages can make use of multiple processors, such as my rgenoud
(genetic optimization using derivatives) and Matching packages,
Hi,
I am working on a multivariate linear regression of the form y = Ax.
I am seeing a great dispersion of y w.r.t x. For example, the
correlations between y and x are very small, even after using some
typical transformations like log, power.
I tried with simple linear regression, robust
On Wed, 5 Apr 2006, Jasjeet Singh Sekhon wrote:
Hi,
64bit CPUs, such as opterons, help significantly with large databases
or if you are running multiple processes. But there is a speed
penalty if you are not.
This would be true of 64-bit builds of R, not 64-bit CPUs.
On a 64-bit
This would be true of 64-bit builds of R, not 64-bit CPUs.
[...]
This doesn't mean that a 32-bit build of R on a 64-bit processor will be
slower than a 32-bit build of R on a 32-bit processor.
There is the issue, however, of running a 32bit application on a 64bit
OS. Under RedHat and SuSE
If you're talking about regression models, then I'm puzzled that
this occurs frequently in R, since the summary.lm() function
defaults to 'correlation = FALSE'. S-PLUS defaults to TRUE.
Can you give an example where R gives you the correlations of
coefficients?
Anyway, parameter estimators are
Ummm...
If y is unrelated to x, then why would one expect any reasonable method to
show a greater or lesser relationship than any other? It's all random. Of
course, put enough random regressors into/tune the parameters enough of
any regression methodology and you'll be able to precisely predict
Hi Bert,
Thank you for your prompt reply.
I understand your point.
But randomness is just a matter of scale of the object (Ramsey
Theory) . The X matrix does not explain the complete variation in Y
due to a large noise in X or simply the mapping f: X-Y is many valued
(or due to other finite
Have you read Pinheiro and Bates (2000) Mixed-Effects Models in S and
S-Plus (Springer). If no, I believe that book should help you. If you
have access to the library at the University of Waikato, as suggested by
your email address, then I suggest you try the library there. The
From: Jasjeet Singh Sekhon
This would be true of 64-bit builds of R, not 64-bit CPUs. [...]
This doesn't mean that a 32-bit build of R on a 64-bit
processor will be
slower than a 32-bit build of R on a 32-bit processor.
There is the issue, however, of running a 32bit application
on
Hello,
How can an interative unit root test be implemented in R?
More specifically, given a time series, I wish to perform the Dickey
Fuller Test on a daily basis for say the last 100 observations. It would
be interative in the sense that this test would be repeated each day for
the last 100
Dear R-help,
I'm using the R2WinBUGS package and getting an error message:
Error in file(file, r) : unable to open connection
In addition: Warning message:
cannot open file 'codaIndex.txt', reason 'No such file or
directory'
I'm using R 2.2.1 and WinBUGS 1.4.1
Dear R-help,
I'm using the R2WinBUGS package and getting an error message:
Error in file(file, r) : unable to open connection
In addition: Warning message:
cannot open file 'codaIndex.txt', reason 'No such file or directory'
I'm using R 2.2.1 and WinBUGS
Hi,
I would like to add a key to my trellis plot using draw.key. Here is what I
want:
3 x 6 key where the first row is a header.
row 1: empty, S-R Mapping, R^2
row 2: pch=17, Color, 0.951
row 2: pch=17, Shape, 0.934
ect...
The problem is that I would like the cell in the upper left corner
On 4/5/06, Steven Lacey [EMAIL PROTECTED] wrote:
Hi,
I would like to add a key to my trellis plot using draw.key. Here is what I
want:
3 x 6 key where the first row is a header.
row 1: empty, S-R Mapping, R^2
row 2: pch=17, Color, 0.951
row 2: pch=17, Shape, 0.934
ect...
The problem
Yes, that works! Thanks!
On a related note... When I draw my key there is not sufficient padding
between the last line of the key and the border line. For instance, the
vertical line in p often drops below the border. Is there an easy way to
add padding between the last row of the key and the
Hello list,
I'm just getting started with using R - I have been trying over the past
day or so to work out a method for generating voronoi polygons for
PostGIS using SQL. I was able to put together a procedure which works
relatively well, but is somewhat inefficient. Someone on the PostGIS
list
On 4/5/06, Steven Lacey [EMAIL PROTECTED] wrote:
Yes, that works! Thanks!
On a related note... When I draw my key there is not sufficient padding
between the last line of the key and the border line. For instance, the
vertical line in p often drops below the border. Is there an easy way to
Try this...
xyplot(y~x,data=data.frame(x=1:10,y=1:10))
keyArgs - list()
keyArgs - list(points=list(pch=c(NA,rep(17,5)),lwd=2,col=c(NA,c(red,
chartreuse3, black, cyan, blue))),
text=list(lab=c(S-R Mapping,
Color,Shape,Letter,Compatible,Incompatible),cex=c(1.2,1,1,1,1,1)),
75 matches
Mail list logo