Hey :)
W2MH = y[43]; #number of infected vaccinated males high risk
> infected with
> non-vaccine strain
>
> length(y0)
[1] 42
As a sidenote, would you mind sharing the flow diagram with me, so I can
show it to my students doing a practical with DeSolve, as example of a
contemporary m
Hi Giorgio,
For a univariate time series? Seriously?
data <- rnorm(10,2,1)
as.matrix(var(data))
Cheers,
Tsjerk
On Sun, May 10, 2015 at 9:54 PM, Giorgio Garziano <
giorgio.garzi...@ericsson.com> wrote:
> Hi,
>
> Actually as variance-covariance matrix I mean:
>
> http://stattrek.com/ma
t; . . .
>
> Σ *x*1 xn / (N-1)
>
> Σ *x*2 *x*1 / (N-1)
>
> Σ *x*22 / (N-1)
>
> . . .
>
> Σ *x*2 *x*n / (N-1)
>
> . . .
>
> . . .
>
> . . .
>
> . . .
>
> Σ *x*n *x*1 / (N-1)
>
> Σ *x*n *x*2 / (N-1)
>
> . . .
>
> Σ *x*n2 / (N-1)
>
>
>
>
>
> Refere
Hi Bob,
You probably want to have a look at the package alphahull.
Cheers,
Tsjerk
On Fri, Aug 15, 2014 at 5:25 PM, Clint Bowman wrote:
> Your question seems to need an answer to, "How do you find a convex hull
> on a sphere?" Google has many references.
>
> Clint BowmanI
Hi Majid,
Maybe no one knew the answer, or the question was not understood. There's
no central board assigning questions to answerers, so sometimes questions
do not find one. You don't have a right to get an answer, but you ask
someone to invest time and do you a favor. Maybe this can be of some v
Hi Murali,
So, the solution to your problem will be to explicitly convert your
matrix to a numeric matrix. Maybe matrix (?matrix) will do, or you'll
also have to use as.numeric (?as.numeric).
The strings on the left seem to me to be the row labels, right..?, not
elements in the matrix/table.
As a
Hi,
The visual editor should take HTML code, shouldn't it? <- would then
be written <-
Haven't tried it though.
Cheers,
Tsjerk
On Fri, Feb 26, 2010 at 10:19 AM, Tal Galili wrote:
> Hi CH,
>
> My solution for this is to work only on the code editor, and never to move
> to the visual editor (onc
Hi,
That seems quite neat. To make it a bit more flexible, and maybe do
some argument acrobatics with bash, you could change the first few
lines to something like
#!/bin/bash
exec R --vanilla -q --slave -e "source(file=pipe(\"sed -n
/^##RSTART/,\$p $0\"))" --args $@
##RSTART
# Script here
Ch
Hi,
Have a look at:
?rainbow
?rgb
?heatmap
In my opinion this would've likely popped up with just a little effort
of searching. In fact, the help of grey() (?grey) already gives
pointers to the other color functions. Please show that you at least
have tried to find answers before posting questio
Hi Michel,
lines(xx,yy,col=zz-2,type="s")
If you use a color vector, say cols, then you can also do
lines(xx,yy,col=cols[zz-2],type="s")
Hope it helps,
Tsjerk
On Mon, Sep 16, 2013 at 8:42 AM, Arnaud Michel wrote:
> Hi
>
> I have the following problem :
> I have 3 vectors xx, yy, zz :
> xx <
2013 at 9:20 AM, Arnaud Michel wrote:
> Hi Tsjerk
> Thank you but the color always remains black !
> I would want that the color changes on the same graph (color = 3 on the 4
> first steps, col = 4 on 5 following steps
>
> Michel
>
> Le 16/09/2013 09:01, Tsjerk Wassenaar a Ã
Hi Mark Na,
Try:
grepl("latitude\\^2",temp)
^ is a control character for negation, so you have to escape it.
Cheers,
Tsjerk
On Mon, Jan 21, 2013 at 4:26 PM, wrote:
> Hello R-helpers,
>
> I am trying to search for string that includes the caret symbol, using the
> following code:
>
> grepl(
Oh, I'm jetlagged. ^ is a control character for 'start of string'. In the
context of a character set it means negation: [^a-z].
Ciao,
Tsjerk
On Mon, Jan 21, 2013 at 4:33 PM, Tsjerk Wassenaar wrote:
> Hi Mark Na,
>
> Try:
>
> grepl("latitude\\^2",temp)
&
t(apply(test,1,sample)) will also do.
As the OP noted, the results are simply transposed. So if an operation is
to be applied to rows, yielding modified rows, simply transpose the results.
Cheers,
Tsjerk
On Tue, May 14, 2013 at 12:07 PM, Ted Harding wrote:
> On 14-May-2013 09:46:32 Duncan Murd
Hi Bianca,
If the domains are rotated between the trajectories, the motion cannot be
captured by a single linear component. Think of projecting an arc on a
straight line. You loose the (deflection) part on the second component.
That looks like squashing. I've mentioned this in relation to MD
simul
Hi :)
Try this with other distributions too... And then search for 'central limit
theorem'.
Cheers,
Tsjerk
On Fri, Oct 25, 2013 at 4:48 PM, Kramer, Christian <
christian.kra...@uibk.ac.at> wrote:
> Hi there,
>
> I have found a strange behavior in R that puzzles me - maybe it is a bug
> or a b
N(mu,sigma^2/n). Exactly. No asymptotics, no approximations, no
> CLT.
>
> cheers,
>
> Rolf Turner
>
>
> On 10/26/13 20:17, Tsjerk Wassenaar wrote:
>
> Hi :)
>
> Try this with other distributions too... And then search for 'central limit
> theorem
> s<-apply(x,1,sd)
> qqnorm(m/(s*sqrt(3)))
Cheers,
T.
On Sat, Oct 26, 2013 at 10:26 AM, Rolf Turner wrote:
> On 10/26/13 21:20, Tsjerk Wassenaar wrote:
>
> Of course. But the point is that this would happen with summing samples
> from any distribution.
>
>
> ***What
Hi Suman,
Try:
array(1:24,c(4,3,2))
Cheers,
Tsjerk
On Thu, Jun 3, 2010 at 6:52 AM, suman dhara wrote:
> Sir,
> I want to use a 3-dimensional array in R. How can I initialize the array?
> Can you give me a eaxmple?
>
> Thanks & Regards,
>
> Suman Dhara
>
> [[alternative HTML version del
Hey,
> To the best of my knowledge, this forum is not for help with homeworks.
Probably it is, but it only works for those who can disguise their
homework as Real Problems :)
It might be good excercise to have a read of
http://www.catb.org/~esr/faqs/smart-questions.html though.
Cheers,
Tsjerk
Hi,
Does it alleviate things if you rewrite the sums to avoid large products?
For I even:
J+I*(N-I/2)-(N-I/2)
For I odd:
J+I*(N-(I+1)/2)-(N-(I+1)/2)+(I+1)/2
Hope it helps,
Tsjerk
On Mon, Feb 7, 2011 at 7:21 AM, Berend Hasselman wrote:
>
>
> Earl F Glynn wrote:
>>
>>
>> 2-byte (16 bit) signe
Yes, thnx... Typo :$
On Mon, Feb 7, 2011 at 8:23 AM, Berend Hasselman wrote:
>
>
> Tsjerk Wassenaar wrote:
>>
>> Hi,
>>
>> Does it alleviate things if you rewrite the sums to avoid large products?
>>
>> For I even:
>> J+I*(N-I/2)-(N-I
Hi Mark,
If you have a function that, for a given file name, returns the data
in the way you want, then you can use 'dir' or 'paste' to generate a
list of names, which you can read in in one go with apply:
my_read <- function(filename)
{
...
}
filenames <- dir(directory,pattern)
filenames <- pa
Hi Anoop,
Not sure whether it's too late for you, but is this along the lines of
what you want?:
x<-0:1000
y<-sin(x/500)+rnorm(1001)/10
z<-cos(x/500)+rnorm(1001)/100
plot(x,y,col=rgb(1,(z-min(z))/(max(z)-min(z)),0))
Or possibly like:
plot(x,y,col=rainbow(256)[255*(z-min(z))/(max(z)-min(z))])
M
Also, googling around one will find the question has been asked (and
answered) already:
http://ask.metafilter.com/25060/Whats-the-sum-of-all-integers
Cheers,
Tsjerk
On Tue, Feb 15, 2011 at 1:33 AM, Kjetil Halvorsen
wrote:
> or even better:
>
> http://mathoverflow.net/
>
> On Sun, Feb 13, 2011
Hi Gene,
It means 'Literal integer'.
So 1L is a proper integer 1, and 0L is a proper integer 0.
Hope it helps,
Tsjerk
On Wed, Feb 23, 2011 at 5:08 PM, Gene Leynes wrote:
> I've been wondering what L means in the R computing context, and was
> wondering if someone could point me to a reference
deaRs,
I want to build a covariance matrix out of the data from a binary
file, that I can read in chunk by chunk, with each chunk containing a
single observation vector X. I wonder how to do that most efficiently,
avoiding the calculation of the full symmetric matrices XX'. The
trivial non-optimal
, so Im not sure of the point of this
exercise.
PS: I actually know how to spell and pronounce Tsjerk, but Tsj is not a very
familiar pattern for my fingers.
*From:* Tsjerk Wassenaar [mailto:tsje...@gmail.com]
*Sent:* Monday, March 14, 2011 1:41 PM
*To:* Dwyer Rex USRE
*Subject:* Re
Hey :)
In addition, although (-2)^3 = -8, (-8)^(1/3) != -2, mathematically. A
fractional power of a negative number is complex. And this can be
obtained properly in R:
> (-8+0i)^(1/3)
[1] 1+1.732051i
Cheers,
Tsjerk
>> This is some interesting:
>>
>>> -8^(1/3)
>>
>> [1] -2
>>
>>> x=(-8:8)
>>
>>
Hi Remko,
You can modify the behaviour upon errors by setting the error option. Check
?option and ?stop
Cheers,
Tsjerk
On Aug 9, 2011 8:35 AM, "Duncan Mackay" wrote:
Hi Remko
After thinking about try and tryCatch the problem was catching the error
what about ?captureOutput
Regards
Duncan
Hi Remko,
The default behaviour of R upon encountering an error is to stop
execution of whatever is happening. To circumvent that, you have to
catch the error, using try, or you have to change the reaction of R to
errors, using 'options'. The help page for ?stop gives an explicit
example of the la
Hi Wei Wu,
What about:
x <- matrix(rnorm(2*5),ncol=5)
y <- rnorm(5)
distances <- rowSums((x-y)**2)
Cheers,
Tsjerk
On Wed, Aug 24, 2011 at 8:43 AM, Enrico Schumann
wrote:
>
> You could do something like this:
>
> # data
> nrows <- 2L
> ncols <- 5L
> myVec <- array(rnorm(nrows * ncols),
-2 -2 -2
> [8,] -3 -3 -3 -3 -3
> [9,] -4 -4 -4 -4 -4
> [10,] -5 -5 -5 -5 -5
>
>
>
>
>> -Ursprüngliche Nachricht-
>> Von: Tsjerk Wassenaar [mailto:tsje...@gmail.com]
>> Gesendet: Mittwoch, 24. August 2011 09:02
>&
Hi Riccardo,
Would it be possible to use max(diag(D))*diag(ncol(D)) - D ? That also
reverses the order of eigenvalues/-vectors.
Cheers,
Tsjerk
On Jan 2, 2012 4:35 PM, "riccardo24" wrote:
Hi, I need to maximize a quadratic function under constraints in R.
For minimization I used solve.QP but f
Sorry, that should've been sum(diag(D)) or max(eigen(D)$values) in stead of
max(diag(D)).
Tsjerk
On Jan 3, 2012 4:52 PM, "Tsjerk Wassenaar" wrote:
Hi Riccardo,
Would it be possible to use max(diag(D))*diag(ncol(D)) - D ? That also
reverses the order of eigenvalues/-vectors.
Hi Rui,
In the R terminal ctrl-c cancels the function, not the session.
Cheers,
Tsjerk
On Oct 20, 2011 7:16 PM, "Rui Esteves" wrote:
Hi,
This question seems very basic but I cannot find an answer on google.
I have a R session on a linux command line.
I called a function that is taking ages.
Hi Wendy,
Most of the binary operators can deal with matrices and vectors natively:
A<-c(12,3,4)
B<-matrix(c(4,10,4,13,2,8),3,2)
B
[,1] [,2]
[1,]4 13
[2,] 102
[3,]48
B wrote:
> On 10/30/2011 02:51 PM, Wendy wrote:
>>
>> Hi,
>>
>> I have a vector and a matrix. For exampl
Hi,
To compare row wise is merely to compare column wise using the transpose matrix:
t(B) < A
or
t(t(B) wrote:
> Given that you want to compare
> columns, you can just do:
>
> A > B
>
> If you wanted to compare rows, then
> it is more troublesome. One approach
> would be:
>
> rep(A, each=nrow(
Hi Lazarus,
Checkout arrays (?array). You can cast your matrix to an array of
submatrices, and calculate the means per block using apply.
Cheers,
Tsjerk
On Mar 14, 2012 9:25 AM, "Lazarus Mramba" wrote:
Dear all,
I have a large matrix with about 2500 variables, and 100 rows.
I would like to
Hi Lazarus,
Sorry for my brevity before. I sent it from a phone.
# Generate dummy data matrix
x <- matrix(1:100,nrow=5)
# Rearrange into array; ten groups of two columns
y <- array(x,c(5,2,10))
# Average columns for each submatrix
apply(y,c(1,3),mean)
# Average per submatrix
apply(y,3,mean)
H
Hi Lazarus,
You should use apply, not sapply.
> a =matrix(1:12, nrow=2,ncol=6,byrow=TRUE)
> b = array(a,c(2,2,3));b
> colMeans(b)
>
> f1=function(x) sum(x)/length(row(a.df[,1:2]))
> y3 <- apply(b, 1, f1)
>
> It only gives one matrix with only two values, I expected 3 values.
To apply the functio
Hi Nymphita,
?upper.tri
x <- as.data.frame(matrix(1:6,6,6))
x[upper.tri(x,diag=TRUE)] <- 0
x
Cheers,
Tsjerk
On Wed, Feb 15, 2012 at 4:33 PM, nymphita wrote:
> Hello!
>
> I'm trying to build a lower triangular matrix (with zeros in the diagonal)
> from a particular dataframe.
>
> The matrix I
Hi Tony,
?nls
Cheers,
Tsjerk
On Feb 15, 2012 8:03 PM, "Anthony Fristachi" wrote:
Greetings,
Any suggestions for approaching the fitting of the function
y = b/exp(a*x) + c*x + y0
where a, b, c, and y0 are unknown constants and y and x are variables in a
give dataset.
Thanks
Tony
Hey,
You could also use (after initializing x):
x[lower.tri(x)] <- data$k
x <- t(x)
Cheers,
Tsjerk
On Feb 16, 2012 6:59 PM, "Rui Barradas" wrote:
Hello,
I'm glad it helped.
The difference in the ordering is due to the fact that R defaults to
column-first ordering.
David's solution uses row
Beste Luis,
Ten eerste wil ik graag meedelen dat het aanbeveling verdient als
iedereen zich bedient van een gezamenlijke taal (Gesamtsprache)
wanneer het internationale communicatie betreft. Hoewel de taal van
voorkeur uiteraard discutabel is, schijnt er toch redelijke consensus
te zijn dat heden
Hi,
For what it's worth, it's a trivial operation to replace the on-board
1Gb with a 2Gb module, which doesn't cost too much. Okay, being a bit
demanding I also replaced the hard-disk with a 320 Gb one to harbour a
dual boot ubuntu-eee / windows XP. But that does give a machine which
is a worthy r
Hi Jo,
To have some more flexibility with coloring I use the following, e.g.
with rainbow colors:
col<- rainbow(255,end=5/6)
colid <- function( x, range=NULL, depth=255 )
{
if ( is.null( range ) )
y <- as.integer(x-min(x))/(max(x)-min(x))*depth+1
else
{
y <- as.intege
?which
On Thu, Mar 19, 2009 at 2:15 PM, tedzzx wrote:
>
> Dear R experts,
>
> How to find out the index of minimum or maxmum number in a vetor or
> data.frame?
>
> For example,
>
> a=
>
> n price
> 1 50
> -2 100
> 0 200
> -1 300
> ..
>
>
> I want to find out the row which the n
Hi Abu,
Your statements only seem to make sense if you have another point you want
to use as reference. I.e. you have a plane through (x0,y0,z0), (x1,y1,z1)
and (x2,y2,z2) and you want to calculate the angle between that plane and a
plane through (x3,y3,z3), (x1,y1,z1) and (x2,y2,z2). The way you
49 matches
Mail list logo