[R] symmetric matrix multiplication

2011-10-23 Thread statfan
I have a symmetric matrix B (17x17), and a (17x17) square matrix A. If do the following matrix multiplication I SHOULD get a symmetric matrix, however i don't. The computation required is: C = t(A)%*%B%*%A here are some checks for symmetry (max(abs(B - t(B [1] 0 C = t(A)%*%B%*%A

Re: [R] symmetric matrix multiplication

2011-10-23 Thread Daniel Nordlund
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of statfan Sent: Saturday, October 22, 2011 10:45 PM To: r-help@r-project.org Subject: [R] symmetric matrix multiplication I have a symmetric matrix B (17x17), and a (17x17)

Re: [R] symmetric matrix multiplication

2011-10-23 Thread Ted Harding
On 23-Oct-11 07:00:07, Daniel Nordlund wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of statfan Sent: Saturday, October 22, 2011 10:45 PM To: r-help@r-project.org Subject: [R] symmetric matrix multiplication I have a

[R] FW: Re: symmetric matrix multiplication

2011-10-23 Thread Ted Harding
Just to avoid possible confusion, let me correct a typo (at step [2] in the example below). Apologies! -FW: xfmail.111023084327.ted.hard...@wlandres.net- Date: Sun, 23 Oct 2011 08:43:27 +0100 (BST) Sender: r-help-boun...@r-project.org From: (Ted Harding) ted.hard...@wlandres.net To:

Re: [R] Data frame manipulation by eliminating rows containing extreme values

2011-10-23 Thread aajit75
Hi David, Thanks for the reply, f=function(x){quantile(x, c(0.25, 0.75),na.rm = TRUE) - matrix(IQR(x,na.rm = TRUE) * c(1.5), nrow = 1) %*% c(-1, 1)} Here parameter 1.5 is set for example in the above function as argument, it can be even more may be 3.0 after analyzing actual data. Here

[R] A problem with chol() function

2011-10-23 Thread Ron Michael
I think I am missing something with the chol() function. Here is my calculation:   mat [,1] [,2] [,3] [,4] [,5] [1,]    1    3    0    0    0 [2,]    0    1    0    0    0 [3,]    0    0    1    0    0 [4,]    0    0    0    1    0 [5,]    0    0    0    0    1 eigen(mat) $values [1] 1 1 1

Re: [R] R for loop stops after 4 iterations

2011-10-23 Thread Philip Robinson
That's fantastic, thank you very much, the qnorm option is interesting, I will have to play around with it. Many thanks again Philip -Original Message- From: R. Michael Weylandt [mailto:michael.weyla...@gmail.com] Sent: Sunday, 23 October 2011 10:28 AM To: Philip Robinson Cc:

Re: [R] A problem with chol() function

2011-10-23 Thread Prof Brian Ripley
On Sun, 23 Oct 2011, Ron Michael wrote: I think I am missing something with the chol() function. Here is my calculation:   mat [,1] [,2] [,3] [,4] [,5] [1,]    1    3    0    0    0 [2,]    0    1    0    0    0 [3,]    0    0    1    0    0 [4,]    0    0    0    1    0 [5,]    0    0   

[R] how to plot a distribution of mean and standard deviation

2011-10-23 Thread gj
Hi, I have the following data about courses (504) in a university, two attributes about the proportion of resources used (#resources_used / #resources_available), namely the average and the standard deviation. Thus I have: [1] n=504 rows [2] 1 id column and 2 attributes Here's a sample of the

Re: [R] issue loading doBy library

2011-10-23 Thread Giovanni Azua
Hi Josh, Thank you for your feedback, after lot of trial and error the problem is finally solved. To solve this problem, I tried in this order: 1) uninstalling the two packages Matrix and lme4 and reinstalling them. 2) uninstalling doBy and reinstalling it with and without 1) 3) upgrading to

Re: [R] issue loading doBy library

2011-10-23 Thread Gabor Grothendieck
On Sun, Oct 23, 2011 at 8:10 AM, Giovanni Azua brave...@gmail.com wrote: Hi Josh, Thank you for your feedback, after lot of trial and error the problem is finally solved. To solve this problem, I tried in this order: 1) uninstalling the two packages Matrix and lme4 and reinstalling them.

Re: [R] how to plot a distribution of mean and standard deviation

2011-10-23 Thread R. Michael Weylandt
It seems like the relevant plot would depend on what you are trying to investigate, but usually a scatterplot would well work for bivariate data with no other assumptions needed. I usually find ecdf() plots rather hard to interpret without playing around with the data elsewhere first and I'm not

Re: [R] how to delete rows by a list of rownames

2011-10-23 Thread B77S
here is one way df1 - data.frame(c(1:20), c(21:40), c(31:50)) list1 - c(3, 6, 20) df2 - df1[-list1,] hanansela wrote: Hello I have a list of row names that needs to be deleted from a data frame. How do i do that? one of the columns in the data frame contains the row names as numbers.

Re: [R] how to delete rows by a list of rownames

2011-10-23 Thread R. Michael Weylandt
I think that only works because the rows are ordered and have no names: try something more like this: df1 - data.frame(1:20, 21:40, 31:50) rownames(df1) - sample(letters, 20) toDrop - sample(rownames(df1), 5) df1[ !(rownames(df1) %in% toDrop), ] or alternatively toKeep - sample(rownames(df1),

Re: [R] R-help Digest, Vol 104, Issue 23

2011-10-23 Thread mihalicza . peter
Október 19-től 21-ig irodán kívül vagyok, és az emailjeimet nem érem el. Sürgős esetben kérem forduljon Kárpáti Edithez (karpati.e...@gyemszi.hu). Üdvözlettel, Mihalicza Péter I will be out of the office from 19 till 21 October with no access to my emails. In urgent cases please contact Ms.

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-23 Thread apeer
Dr. Harrell, Thanks for your response. The predictor variables I initially included in the model were based on the x mean plots and whether they exhibited ordinality and whether they appeared to meet the CR assumptions. Only 7 of 16 potential variables fit that designation and those are the

[R] how to delete rows by a list of rownames

2011-10-23 Thread hanansela
Hello I have a list of row names that needs to be deleted from a data frame. how do i do that. one of the columns in the data frame contains the row names as numbers I can also select by this column(will it be easier?). Thank you -- View this message in context:

[R] How to create a new variable based on parts of another character variable.

2011-10-23 Thread Philipp Fischer
Hello, I am just starting with R and I am having a (most probably) stupid problem by creating a new variable in a data.frame based on a part of another character variable. I have a data frame like this one: A B C AWI-test1 1 i AWI-test5

Re: [R] How to create a new variable based on parts of another character variable.

2011-10-23 Thread jim holtman
Use regular expressions ?grepl On Sunday, October 23, 2011, Philipp Fischer philipp.fisc...@awi.de wrote: Hello, I am just starting with R and I am having a (most probably) stupid problem by creating a new variable in a data.frame based on a part of another character variable. I have a data

Re: [R] A problem with chol() function

2011-10-23 Thread Bert Gunter
Perhaps to clarify Prof. Ripley's remarks below , the part that you missed was symmetric, which your matrix obviously is not. -- Bert 2011/10/23 Prof Brian Ripley rip...@stats.ox.ac.uk On Sun, 23 Oct 2011, Ron Michael wrote: I think I am missing something with the chol() function. Here is

[R] unfold list (variable number of columns) into a data frame

2011-10-23 Thread Giovanni Azua
Hello, I used R a lot one year ago and now I am a bit rusty :) I have my raw data which correspond to the list of runtimes per minute (minute 1 2 3 in two database modes sharding and query and two workload types query and refresh) and as a list of char arrays that looks like this: str(data)

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-23 Thread Frank Harrell
That's not reasonable for 2 reasons. First, selecting variables based on apparent assumption satisfaction is an unexplored technique. Second, you failed to account for variable selection during resampling validation. You will need to give the model all CANDIDATE variables and use the bw=TRUE

Re: [R] how to plot a distribution of mean and standard deviation

2011-10-23 Thread Ben Bolker
R. Michael Weylandt michael.weylandt at gmail.com writes: It seems like the relevant plot would depend on what you are trying to investigate, but usually a scatterplot would well work for bivariate data with no other assumptions needed. I usually find ecdf() plots rather hard to interpret

Re: [R] Segfault and bad output with fOptions::rnorm.sobol

2011-10-23 Thread Robert McDonald
I think your question is answered by http://cran.r-project.org/web/packages/fOptions/ChangeLog 2010-04-23 chalabi * ChangeLog, DESCRIPTION: updated DESCR and ChangeLog * src/085A-LowDiscrepancy.f: fixed sobol RVS on 64 bit platform * ChangeLog, DESCRIPTION: updated

[R] Exponential fit of form y=exp(a*x) and not of form y=l*exp(a*x)

2011-10-23 Thread Henri Mone
Dear R Users, Beginners and Experts, I want to fit to my data an exponential function with following functional form: y=exp(a*x) I used the function nls but this gives me exponential fits with following functional form: y=l*exp(a*x) With l being an scaling factor. What do I need to change in my

[R] Mlogit dummy problem

2011-10-23 Thread Ville Iiskola
Hi I have tried to estimate race winning probabilities with mlogit in R. I have different amount of contestors in the races and mlogit has a bug so that in those situations the mlogit does not work. So i tried to add dummy contestors to the race so that every race has an equal amount of

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-23 Thread apeer
I guess I must be misunderstanding the point of checking the ordinality assumptions prior to fitting a model. Are you saying that a response variable that does not behave in an ordinal fashion can still be included in the initial and final model? -- View this message in context:

Re: [R] unfold list (variable number of columns) into a data frame

2011-10-23 Thread Dennis Murphy
Hi: Here's one approach: # Function to process a list component into a data frame ff - function(x) { data.frame(time = x[1], partitioning_mode = x[2], workload = x[3], runtime = as.numeric(x[4:length(x)]) ) } # Apply it to each element of the list: do.call(rbind,

Re: [R] Exponential fit of form y=exp(a*x) and not of form y=l*exp(a*x)

2011-10-23 Thread Ben Bolker
Henri Mone henriMone at gmail.com writes: I want to fit to my data an exponential function with following functional form: y=exp(a*x) I used the function nls but this gives me exponential fits with following functional form: y=l*exp(a*x) With l being an scaling factor. What do I need

Re: [R] Imposing Feller condition using project constraint in spg

2011-10-23 Thread Kristian Lind
Hi Ravi, Thank you for your reply and please excuse my late response. Plugging w2’ = k/w1’ from (A) into (B) yields (C) f(w1') = (w1-w1’)^2 + (w2-k/w1’)^2 The partial derivative wrt w1' is (D) df(w1')/ dw1' = -2(w1-w1’) + 2(w2-k/w1’)*k/(w1')^2 in order for this to be a minimum the f.o.c.

Re: [R] setMethod [ - extract by names within Slot

2011-10-23 Thread Martin Morgan
On 10/22/2011 08:03 AM, Omphalodes Verna wrote: Thanks Martin. Here is my ''updated'' code. setClass(myClass, representation(ID.r = numeric, ID.c = character, DAT = matrix)) to.myClass- function(ID.r, ID.c, DAT) { out- new(myClass, ID.r = ID.r, ID.c = ID.c, DAT = DAT) return(out)

Re: [R] unfold list (variable number of columns) into a data frame

2011-10-23 Thread Giovanni Azua
Hi Dennis, Thank you very nice :) Best regards, Giovanni On Oct 23, 2011, at 6:55 PM, Dennis Murphy wrote: Hi: Here's one approach: # Function to process a list component into a data frame ff - function(x) { data.frame(time = x[1], partitioning_mode = x[2], workload = x[3],

[R] summarizing a data frame i.e. count - group by

2011-10-23 Thread Giovanni Azua
Hello, This is one problem at the time :) I have a data frame df that looks like this: time partitioning_mode workload runtime 1 1 shardingquery 607 2 1 shardingquery 85 3 1 shardingquery 52 4 1 shardingquery

Re: [R] summarizing a data frame i.e. count - group by

2011-10-23 Thread David Winsemius
On Oct 23, 2011, at 1:29 PM, Giovanni Azua wrote: Hello, This is one problem at the time :) I have a data frame df that looks like this: df -read.table(textConnection( time partitioning_mode workload runtime + 1 1 shardingquery 607 + 2 1 sharding

[R] Summary stats in table

2011-10-23 Thread Duncan Murdoch
Suppose I have data like this: A - sample(letters[1:3], 1000, replace=TRUE) B - sample(LETTERS[1:2], 1000, replace=TRUE) x - rnorm(1000) I can get a table of means via tapply(x, list(A, B), mean) and I can add the marginal means to this using cbind/rbind: main - tapply(x, list(A,B), mean)

Re: [R] plotting with a symbol on every nth point

2011-10-23 Thread Carl Witthoft
If you just want the same symbol at each point, you could use Weylandt's approach, tho' personally I think it's tidier to create a new vector x10 - x[seq(1,length(x),by=10)] and plot that. If you would like a different symbol at each point, then take a look at ?text. quote From: R.

[R] how to save an R object to a remote computer

2011-10-23 Thread Molly Davies
Hello, I am running R remotely on my university's network from my laptop (Macbook Pro, running leopard, in case this is useful). I have a strict limit on how much disk space I can take up on my network account at school, which is insufficient for the size of some of the objects I need to

Re: [R] Exponential fit of form y=exp(a*x) and not of form y=l*exp(a*x)

2011-10-23 Thread Carl Witthoft
You misused nls(). Observe: x- 1:101 y2 - 5*exp(x/20) + runif(101)/100 # nls will NOT converge for perfect data. nls(y2 ~ exp(A*x), start=list(A=.1)) Nonlinear regression model model: y2 ~ exp(A * x) data: parent.frame() A 0.06709 residual sum-of-squares: 136703 Number of

Re: [R] how to save an R object to a remote computer

2011-10-23 Thread Barry Rowlingson
On Sun, Oct 23, 2011 at 7:46 PM, Molly Davies mollymdav...@gmail.com wrote: Hello, I am running R remotely on my university's network from my laptop (Macbook Pro, running leopard, in case this is useful). I have a strict limit on how much disk space I can take up on my network account at

Re: [R] Exponential fit of form y=exp(a*x) and not of form y=l*e

2011-10-23 Thread Ted Harding
On 23-Oct-11 19:03:05, Carl Witthoft wrote: You misused nls(). Observe: x- 1:101 y2 - 5*exp(x/20) + runif(101)/100 # nls will NOT converge for perfect data. nls(y2 ~ exp(A*x), start=list(A=.1)) Nonlinear regression model model: y2 ~ exp(A * x) data: parent.frame() A

Re: [R] how to save an R object to a remote computer

2011-10-23 Thread Molly Davies
Thank you for the suggestions! I'm actually running simulations in R over two separate networks (and thus will need to smile sweetly (and authentically, of course!) twice). In one, I am ssh-ing from my Mac laptop into one Mac machine with 32 cpu. In the other, I am ssh-ing into a cluster and am

Re: [R] symmetric matrix multiplication

2011-10-23 Thread statfan
Thank you Dan and Ted for these helpful comments. I will implement this simple force symmetry code you suggested and make sure I familiarize with this floating-point calculation problem so I can recognize such issues in the future. -- View this message in context:

Re: [R] summarizing a data frame i.e. count - group by

2011-10-23 Thread Tyler Rinker
This could be done with aggregate but I am unfamiliar with it so I'll give what I think you want from your message using the library 'reshape' that you'll have to doneload. If you're problem is large the data.table library would be much faster. You haven't really said what you'd like to get

Re: [R] Summary stats in table

2011-10-23 Thread Tyler Rinker
I had to set it up as a data frame and then it workd beautifully with the reshape package. DF-data.frame(A,B,x) library(reshape) cast(DF, A ~ B, fun.aggregate=mean, margins=c(grand_row, grand_col)) Cheers Tyler Date: Sun, 23 Oct 2011

Re: [R] how to delete rows by a list of rownames

2011-10-23 Thread hanansela
Thank you, Michael This is what i need. It works fine -- View this message in context: http://r.789695.n4.nabble.com/how-to-delete-rows-by-a-list-of-rownames-tp3930206p3931200.html Sent from the R help mailing list archive at Nabble.com. __

[R] Creating 2 week intervals (lubridate)

2011-10-23 Thread sparklegirl100
Hello, I have a list of dates in which I am going use for a time series analysis. I want to break these dates up into 2 week intervals and count the number of times a date appears in this interval. For example from Nov. 19, 2000 to Dec 2 ,2000 with the data listed below I want to return

[R] cex multiplier not exact

2011-10-23 Thread Ali Tofigh
Hi, When I plot text and use cex to change the text size, I notice that the cex multiplier is not exact. It looks as if the real size of text can take only certain discrete values. Is there a workaround to get text to follow the cex value more closely, or at least to be able to figure out what

[R] code review: is it too much to ask?

2011-10-23 Thread Giovanni Azua
Hello all, I really appreciate how helpful the people in this list are. Would it be too much to ask to send a small script to have it peer-reviewed? to make sure I am not making blatant mistakes? The script takes an experiment.dat as input and generates system Throughput using ggplot2. It

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-23 Thread Frank Harrell
You also did unaccounted for stepwise selection. Regarding the proportional odds assumption, if you assessed it correctly, something that is not operating proportionally would have to be associated with the outcome for at least one cutoff of Y, so you could say that you are doing reverse

[R] diptest

2011-10-23 Thread Matilde
I am a very new user of R and I need some suggestions on how perform a diptest. I dowloaded the package diptest. following instructions given by the file I attach R I performed a diptest on the dataset statfaculty. However I do not manage to do it with my dataset that consists of a single column

[R] manova/tukey test

2011-10-23 Thread Molly MacLeod
Hello, I am trying to do a manova test in r, and have used the manova function to test differences between two dependent variables. The results were significant for the whole model, but the sources I've read say that in order to do a post-hoc multiple comparison, I have to do separate aovs for

Re: [R] Creating 2 week intervals (lubridate)

2011-10-23 Thread David Winsemius
On Oct 23, 2011, at 4:18 PM, sparklegirl...@hotmail.com sparklegirl...@hotmail.com wrote: Hello, I have a list of dates in which I am going use for a time series analysis. I want to break these dates up into 2 week intervals and count the number of times a date appears in this

Re: [R] summarizing a data frame i.e. count - group by

2011-10-23 Thread jim holtman
Another package to consider, especially if your dataframe is large, is 'data.table': tp - read.table(textConnection( time partitioning_mode workload runtime + 1 1 shardingquery 607 + 2 1 shardingquery 85 + 3 1 shardingquery 52 + 4

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-23 Thread apeer
Does your point about proportionality also hold for ordinality? In other words, if I have several X variables that do not behave in an ordinal fashion with Y, should I still include them in the full model? My understanding or perhaps misunderstanding of the ordinality assumption was that all X

[R] RGtk2 problems

2011-10-23 Thread Aref Nammari
Hello, I hope this is the right place to ask for help with a problem I am having with RGtk2 installation with R on Windows XP. I am running R 2.11.1 and have installed the package RGtk2 from CRAN. I also have GTK 2.10.11 installed as well as GTK2-runtime 2.22.0. I have added the environment

Re: [R] interpreting bootstrap corrected slope [rms package]

2011-10-23 Thread David Winsemius
On Oct 23, 2011, at 7:37 PM, apeer wrote: Does your point about proportionality also hold for ordinality? In other words, if I have several X variables that do not behave in an ordinal fashion with Y, should I still include them in the full model? My understanding or perhaps

Re: [R] Segfault and bad output with fOptions::rnorm.sobol

2011-10-23 Thread Robert McDonald
On Sun, Oct 23, 2011 at 11:48 AM, Robert McDonald rmcd1...@gmail.comwrote: I think your question is answered by http://cran.r-project.org/web/packages/fOptions/ChangeLog 2010-04-23 chalabi * ChangeLog, DESCRIPTION: updated DESCR and ChangeLog * src/085A-LowDiscrepancy.f:

Re: [R] summarizing a data frame i.e. count - group by

2011-10-23 Thread Dennis Murphy
And the plyr version of this would be (using DF as the data frame name) ## transform method, mapping length(runtime) to all observations ## similar to David's results: library('plyr') ddply(DF, .(time, partitioning_mode), transform, n = length(runtime)) # or equivalently, the newer and somewhat

[R] Offtopic sourceforge problems?

2011-10-23 Thread Erin Hodgess
Dear R People: I've been trying to get R Portable from sourceforge.net all day today and there is a problem accessing the site. Has anyone else run into that, please? Thank you! Sincerely, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University