Re: [R] Finding solution set of system of linear equations.

2011-05-21 Thread Robert A LaBudde
solve() only works for nonsingular systems of equations. Use a generalized inverse for singular systems: > A<- matrix(c(1,2,1,1, 3,0,0,4, 1,-4,-2,-2, 0,0,0,0), ncol=4, byrow=TRUE) > A [,1] [,2] [,3] [,4] [1,]1211 [2,]3004 [3,]1 -4 -2 -2 [4,]0

Re: [R] nls package

2011-05-21 Thread David Winsemius
On May 21, 2011, at 9:33 PM, magushi wrote: Hi I want to analyse my data (using nonlinear regression ) but I can not load and install the package. this package (nls) not available in my R. how get it. nls() is a function that is part of the stats package which is installed automatica

Re: [R] Confidence Interval of Specral Density Plot

2011-05-21 Thread David Winsemius
On May 21, 2011, at 3:27 AM, Zablone Owiti wrote: Dear Users, I wish to know at what confidence level is the confidence interval provided in the Spectrum function (plot.spec) plots. The default level is clearly indicated in the arguments of the Usage section on the help page of plot.spec

Re: [R] nls package

2011-05-21 Thread magushi
Please let me know how to get this package. Thanks On Sat, May 21, 2011 at 9:50 PM, dslowik [via R] < ml-node+3541502-716551039-239...@n4.nabble.com> wrote: > nls is part of the stats 'package'. > > -- > If you reply to this email, your message will be added to the di

Re: [R] nls package

2011-05-21 Thread dslowik
nls is part of the stats 'package'. -- View this message in context: http://r.789695.n4.nabble.com/nls-package-tp3541485p3541502.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mai

[R] nls package

2011-05-21 Thread magushi
Hi I want to analyse my data (using nonlinear regression ) but I can not load and install the package. this package (nls) not available in my R. how get it. -- View this message in context: http://r.789695.n4.nabble.com/nls-package-tp3541485p3541485.html Sent from the R help mailing list archiv

[R] Finding solution set of system of linear equations.

2011-05-21 Thread dslowik
I have a simple system of linear equations to solve for X, aX=b: > a [,1] [,2] [,3] [,4] [1,]1211 [2,]3004 [3,]1 -4 -2 -2 [4,]0000 > b [,1] [1,]0 [2,]2 [3,]2 [4,]0 (This is ex Ch1, 2.2 of Artin, Algebra). So, 3 eqs

Re: [R] Adding a numeric to all values in the dataframe

2011-05-21 Thread John Kane
--- On Fri, 5/20/11, David Winsemius wrote: > From: David Winsemius > Subject: Re: [R] Adding a numeric to all values in the dataframe > To: "John Kane" > Cc: bill.venab...@csiro.au, ramya.vict...@gmail.com, r-help@r-project.org > Received: Friday, May 20, 2011, 10:11 PM > > On May 20, 2011,

Re: [R] maximum likelihood convergence reproducing Anderson Blundell 1982 Econometrica R vs Stata

2011-05-21 Thread Mike Marchywka
> From: rvarad...@jhmi.edu > To: marchy...@hotmail.com; pda...@gmail.com; alex.ols...@gmail.com > CC: r-help@r-project.org > Date: Sat, 21 May 2011 17:26:29 -0400 > Subject: RE: [R] maximum likelihood convergence reproducing Anderson Blundell > 1

Re: [R] Group close numbers in a vector

2011-05-21 Thread Salih Tuna
Yes this is exactly what i want, thanks Jim. One last question, (i am sure this is a very simple question but i am still learning) how can i write the output to a txt file seperately? vector 1 to one file and vector 2 to another and etc? thanks salih On Sat, May 21, 2011 at 11:41 PM, jim holtman

Re: [R] unbalanced anova with subsampling (Type III SS)

2011-05-21 Thread Rolf Turner
On 21/05/11 15:15, Sam Chand wrote: > Hello R-users, > I am trying to obtain Type III SS for an ANOVA with subsampling. My design > is slightly unbalanced with either 3 or 4 subsamples per replicate. > > The basic aov model would be: > fit<- aov(y~x+Error(subsample)) > > But this gives Type I SS an

[R] dealing with sweave.sty and pgfSweave

2011-05-21 Thread ravi
Hi, I would appreciate some help with a very basic problem in using pgfSweave. That is, dealing with the sweave.sty file. After some googling, I did the following : (1) copied the sweave.sty file to my trial folder and (2) added the line   \usepackage{Sweave}   to the Rnw file. Are there more e

Re: [R] Group close numbers in a vector

2011-05-21 Thread jim holtman
Is this what you are after: > x = c(1 ,2 ,4 ,7 ,9 ,10 ,15) > # partition if the difference is > 2) > breaks <- cumsum(c(0, diff(x) > 2)) > # partition into different lists > split(x, breaks) $`0` [1] 1 2 4 $`1` [1] 7 9 10 $`2` [1] 15 On Sat, May 21, 2011 at 6:03 PM, Salih Tuna wrote: > Hi

Re: [R] Group close numbers in a vector

2011-05-21 Thread Salih Tuna
Hi Robert, thanks for your reply. is there a way to store them in separate vectors? and when i try it with a different example i got different result. For example if x = [1 2 8 9] i want the result to be x1 = [1 2] and x2 = [8 9]. thanks On Sat, May 21, 2011 at 7:16 PM, Robert Baer wrote: > Hi e

Re: [R] Looping through values in a data frame that are >zero

2011-05-21 Thread Dennis Murphy
Hi: Does this work for the first problem? library(reshape2) subset(melt(x, id = c('y', 'z')), value > 0) y z variable value 3 c oa 1 6 a mb 2 14 d pc 4 The second problem is so convoluted I don't even know where to start... HTH, Dennis On Sat, May 21,

Re: [R] maximum likelihood convergence reproducing Anderson Blundell 1982 Econometrica R vs Stata

2011-05-21 Thread Ravi Varadhan
Hi, I don't think the final verdict has been spoken. Peter's posts have hinted at ill-conditioning as the crux of the problem. So, I decided to try a couple of more things: (1) standardizing the covariates, (2) exact gradient, and (3) both (1) and (2). I compute the "exact" gradient using a

Re: [R] predict 'expected' with eha package

2011-05-21 Thread Göran Broström
Mike, On Sat, May 21, 2011 at 10:15 PM, Mike Harwood wrote: > I am unsure what is being returned, and what is supposed to be > returned, when using 'predict' with "type='expected'" for an aftreg > survival model. I'm sorry, but there is no 'predict.aftreg'. The generic 'predict' "works" because

Re: [R] (no subject)

2011-05-21 Thread Bert Gunter
Amen to David's comments (I'm sorry to say ...) In addition: Learn to use the Help system. ?help (at the command line) and "An Introduction to R" manual provide info. To answer your question: library(lattice) ?strip.default -- Bert On Sat, May 21, 2011 at 1:27 PM, David Winsemius wrote: > > O

[R] predict 'expected' with eha package

2011-05-21 Thread Mike Harwood
I am unsure what is being returned, and what is supposed to be returned, when using 'predict' with "type='expected'" for an aftreg survival model. The code below first generates a weibull model, then uses predict to create a vector of the linear predictors, then attempts to create the 'expected'

Re: [R] (no subject)

2011-05-21 Thread David Winsemius
On May 21, 2011, at 3:15 PM, Ramnath R wrote: What does *strip=function *and *strip.default *means for eg: *strip=function(bg='white', ... ) strip.default(bg='white', ...) I am guessing from my experience that you are working on a plotting problem and trying to understand some lat

Re: [R] 'apply' with additional class variable

2011-05-21 Thread Mark Ebbert
Thanks for the tip Josh! I thought about combining the data, but wondered if there was a way to pass in the information as a separate argument. But I went ahead with your solution and it worked perfectly. Thanks! On May 21, 2011, at 12:57 PM, Joshua Wiley wrote: > Hi Mark, > > Is there a reason

[R] (no subject)

2011-05-21 Thread Ramnath R
What does *strip=function *and *strip.default *means for eg: *strip=function(bg='white', ... ) strip.default(bg='white', ...) *Ram [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/

Re: [R] 'apply' with additional class variable

2011-05-21 Thread Joshua Wiley
Hi Mark, Is there a reason you cannot simply include the make of the car along with all the other data? Using your example: cbind(as.data.frame(t(x)), carmake) then instead of applying across columns, apply across rows, and have your custom function decide what to do based on the column named "

Re: [R] How to intantiate a list of data.frames?

2011-05-21 Thread Joshua Wiley
Hi Rui, Here is one option: ds <- vector("list", 6) for(i in 1:6) ds[[i]] <- list(df = mtcars[, c(i, i + 2)], df2 = mtcars[, c(i, i + 2)] + 10) another could be: altds <- lapply(1:6, function(x) { list(df = mtcars[, c(x, x + 2)], df2 = mtcars[, c(x, x + 2)] + 10) }) all.equal(ds, altds) For

Re: [R] convert binary vector to time series of sum(x)/minute

2011-05-21 Thread Jorge Ivan Velez
Hi mac, Try N <- 6000 x <- sample(1:0, N, TRUE) tapply(x, rep(1:(N/60), each = 60), sum) HTH, Jorge On Sat, May 21, 2011 at 1:59 PM, andyjmac <> wrote: > Dear members, > > I apologize for the relatively simple request, but I couldn't find exactly > what I was looking for. I have a binary vect

[R] 'apply' with additional class variable

2011-05-21 Thread Mark Ebbert
Dear R gurus, I'm trying to solve what I assume is a fairly simple problem, but I'm having trouble finding the proper approach. I have a matrix where each column is some object (e.g. a car) and each row is a numeric measurement of a feature of said object (e.g. horse power, top speed, etc.). Le

[R] convert binary vector to time series of sum(x)/minute

2011-05-21 Thread andyjmac
Dear members, I apologize for the relatively simple request, but I couldn't find exactly what I was looking for. I have a binary vector [1,0] representing presence/absence at 1 second intervals over length(N). I would like to convert this to a new time series vector with N/60 elements that represe

[R] How to intantiate a list of data.frames?

2011-05-21 Thread Rui Maximo
Hello, I am newbie to R and I want to do this: for(i in 1:6) { ds[i] <- list(df=data.frame(oilDF[,1],oilDF[,i+2]), df2=data.frame(oilDF2[,1],oilDF2[,i+2])) } #oilDF and oilDF2 are 2 data frames with several columns. They have different number of rows #I want to have for example ds[1

Re: [R] Group close numbers in a vector

2011-05-21 Thread Robert Baer
Hi everyone, i am trying to group close numbers in a vector. For example i have a vector x = [1 2 4 7 9 10 15]. I want the code to pick 1 2 4 (max difference between successive numbers is 2) and assign them to variable a, then pick 7 9 10 and assign them to b and 15 to c. But since i do not kno

Re: [R] multilevel

2011-05-21 Thread David Winsemius
On May 20, 2011, at 3:54 PM, eeecon wrote: Hi, My code indicates there may be a bug in multilevel. I doubt this is actually the case, can anyone tell me what is wrong with my code? The data file for this code can be downloaded here: http://cameron.econ.ucdavis.edu/mmabook/mma15p4gev.asc H

Re: [R] multilevel

2011-05-21 Thread David Winsemius
On May 21, 2011, at 11:56 AM, eeecon wrote: Correction, this is not an issue with multilevel, rather a quirk with aggregate. So change you subject. Sill looking for help, anyone? About what? -- David Winsemius, MD West Hartford, CT __ R-help@

[R] Group close numbers in a vector

2011-05-21 Thread Salih Tuna
Hi everyone, i am trying to group close numbers in a vector. For example i have a vector x = [1 2 4 7 9 10 15]. I want the code to pick 1 2 4 (max difference between successive numbers is 2) and assign them to variable a, then pick 7 9 10 and assign them to b and 15 to c. But since i do not know ho

Re: [R] multilevel

2011-05-21 Thread eeecon
Correction, this is not an issue with multilevel, rather a quirk with aggregate. Sill looking for help, anyone? -- View this message in context: http://r.789695.n4.nabble.com/multilevel-tp3539421p3540800.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Help using "tm" text mining package - preprocessing

2011-05-21 Thread Spencer Graves
Is there a way to use "tm" with the Slovene characters? I ask, because I was hoping to use "tm" with languages like Arabic, Urdu, Farsi, and Hebrew. If you need to translate Slovene characters, it could create problems with using the software for the desired purpose in many languages, i

Re: [R] Simple R Question...

2011-05-21 Thread David Winsemius
On May 21, 2011, at 7:37 AM, Lars Bishop wrote: Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make my selection based on a vector of na

Re: [R] outout clarification of fitdist {fitdistrplus} output

2011-05-21 Thread Ben Bolker
Alexander Kapeller alexander-kapeller.de> writes: > > Hello, > > I like to fit data against a negative binominal distribution > [snip] > I am wondering how to translate the size and the mu parameter into the usual > number of successes (n) and the contiuous probability (p) . To me it is not

Re: [R] predict.gls choking on levels of factor

2011-05-21 Thread Ben Bolker
Mitchell Maltenfort gmail.com> writes: > > I've got a gls formula that's a mix of continuous and ordered variables. > > I wanted to use gls because I wanted to use the varIdent structure. > > Anyway, attempts to use "predict.gls" choke with the error that the > levels I use are not allowed for

[R] predict.gls choking on levels of factor

2011-05-21 Thread Mitchell Maltenfort
I've got a gls formula that's a mix of continuous and ordered variables. I wanted to use gls because I wanted to use the varIdent structure. Anyway, attempts to use "predict.gls" choke with the error that the levels I use are not allowed for one of them -- the first one alphabetically, so I'd gue

Re: [R] Looping through values in a data frame that are >zero

2011-05-21 Thread Berend Hasselman
Dimitri Liakhovitski-2 wrote: > > Hello! > > I've tried for a while - but can't figure it out. I have data frame x: > > y=c("a","b","c","d","e") > z=c("m","n","o","p","r") > a=c(0,0,1,0,0) > b=c(2,0,0,0,0) > c=c(0,0,0,4,0) > x<-data.frame(y,z,a,b,c,stringsAsFactors=F) > str(x) > Some of the val

Re: [R] Looping through values in a data frame that are >zero

2011-05-21 Thread Bert Gunter
Dmitri: 1. I did not read your whole missive. I prefer mystery novels. ;-) 2. I suggest you banish Excel language ("cells") from your vocabulary and think in R's terms of whole objects that one indexes into. 3. If I understand correctly, you can't combine results into a data frame, because they

Re: [R] Looping through values in a data frame that are >zero

2011-05-21 Thread David Winsemius
On May 21, 2011, at 9:12 AM, Dimitri Liakhovitski wrote: Hello! I've tried for a while - but can't figure it out. I have data frame x: y=c("a","b","c","d","e") z=c("m","n","o","p","r") a=c(0,0,1,0,0) b=c(2,0,0,0,0) c=c(0,0,0,4,0) x<-data.frame(y,z,a,b,c,stringsAsFactors=F) str(x) Some of the

[R] Problem with ANOVA repeated measures: "Error() model is singular"

2011-05-21 Thread angelo.arc...@virgilio.it
Hello everybody, I need an help because I don´t know if the command for the ANOVA analysis I am performing in R is correct. Indeed using the function aov I get the following error:"In aov (..) Error() model is singular" The structure of my table is the following: subject, stimulus, conditio

Re: [R] unbalanced anova with subsampling (Type III SS)

2011-05-21 Thread John Fox
Dear Sam, I don't think that you can use the Anova() function in the car package for this design because there would be no way to specify the error term. Sorry, John John Fox Senator William McMaster Professor of Social Statistics Department of Sociology McMas

[R] Looping through values in a data frame that are >zero

2011-05-21 Thread Dimitri Liakhovitski
Hello! I've tried for a while - but can't figure it out. I have data frame x: y=c("a","b","c","d","e") z=c("m","n","o","p","r") a=c(0,0,1,0,0) b=c(2,0,0,0,0) c=c(0,0,0,4,0) x<-data.frame(y,z,a,b,c,stringsAsFactors=F) str(x) Some of the values in columns a,b, and c are >0: I need to write a loop

Re: [R] Help using "tm" text mining package - preprocessing

2011-05-21 Thread Matevž Pavlič
Got it...the problem was with Slovenian characters. Once i replaced them with normal characters it works fine. Tnx anyway, m -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of mpavlic Sent: Saturday, May 21, 2011 1:06 PM To: r-help@r-

Re: [R] DocumentTermMatrix error

2011-05-21 Thread Matevž Pavlič
Got it...the problem was with Slovenian characters. Once i replaced them with normal characters it works fine. Tnx anyway, m -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Matevž Pavlič Sent: Saturday, May 21, 2011 1:27 PM To: r-

Re: [R] Simple R Question...

2011-05-21 Thread Patrick Burns
Are you looking for: dd[, "a", drop=FALSE] On 21/05/2011 12:37, Lars Bishop wrote: Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make m

Re: [R] Simple R Question...

2011-05-21 Thread Jeff Newmiller
Or dd[,myname] should work too. If you are worried about getting multiple columns, you can just make myname a vector of column names using c() before you use either Jim's list indexing or the above matrix indexing syntax.

Re: [R] Simple R Question...

2011-05-21 Thread Jim Holtman
dd[[ myname]] Sent from my iPad On May 21, 2011, at 7:37, Lars Bishop wrote: > Let's say I have the data frame 'dd' below. I'd like to select one > column from this data frame (say 'a') and keep its name in the > resulting data frame. That can be done as in #2. However, what if I > want to make

[R] Simple R Question...

2011-05-21 Thread Lars Bishop
Let's say I have the data frame 'dd' below. I'd like to select one column from this data frame (say 'a') and keep its name in the resulting data frame. That can be done as in #2. However, what if I want to make my selection based on a vector of names (and again keep those names in the resulting dat

[R] DocumentTermMatrix error

2011-05-21 Thread Matevž Pavlič
Hi all, I have tried to create a DocumentTermMatrix with a tm package, but i get this error : Error in tolower(txt) : invalid input 'PROD Z LAHKO GNETNO MELJNO GLINO, ... in 'utf8towcs' I tried doing this as it is showed in : http://www.r-project.org/doc/Rnews/Rnews_2008-2.pdf (

Re: [R] Help using "tm" text mining package - preprocessing

2011-05-21 Thread mpavlic
Hi, ia have similar problem you had.Did you manage to find out what that error meant? thanks, m -- View this message in context: http://r.789695.n4.nabble.com/Help-using-tm-text-mining-package-preprocessing-tp3299399p3540468.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Downloading a csv from Dropbox using the shareable link

2011-05-21 Thread Timothy Bates
> Person A is working on the file on their computer the path to the data would > be (Mac OSX) /Users/PersonA/Dropbox/Project/data.csv However, to Person B > the path would be /Users/PersonB/Dropbox/data.csv I'm looking for a way to > keep the path to data.csv universal and independent of who i

Re: [R] source and localhost

2011-05-21 Thread Hugo Mildenberger
Thomas, your example works with R-2.13.0 and Apache running on Gentoo. You may try to use "http://127.0.0.1:5984/path/fn.R";, just to exclude that this problem has anything to do with name resolution. Best Hugo > Dear List, > > I have problems with the function source() using a > url of the k

Re: [R] All possible samples for two variables

2011-05-21 Thread Alexander Engelhardt
Am 21.05.2011 06:30, schrieb Sharma D: How to generate all possible samples of size 5 for the two variables in one analysis. Like this? > x <- 1:5 > y <- 6:10 > expand.grid(x,y) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listi

[R] Confidence Interval of Specral Density Plot

2011-05-21 Thread Zablone Owiti
Dear Users, I wish to know at what confidence level is the confidence interval provided in the Spectrum function (plot.spec) plots. The only information provided in the help regarding this is : a confidence interval will be plotted by plot.spec: this is asymmetric, and the width of the centre

[R] permutation/randomization test assumption on observations

2011-05-21 Thread Wenjin Mao
Hi, I have two groups of data of different size:    group A: x1, x2, , x_n;    group B: y1, y2, , y_m; (m is not equal to n) The two groups are independent but observations within each group are not independent, i.e., x1, x2, ..., x_n are not independent; but x's are independent from y'

[R] All possible samples for two variables

2011-05-21 Thread Sharma D
How to generate all possible samples of size 5 for the two variables in one analysis. -- View this message in context: http://r.789695.n4.nabble.com/All-possible-samples-for-two-variables-tp3540107p3540107.html Sent from the R help mailing list archive at Nabble.com.

[R] unbalanced anova with subsampling (Type III SS)

2011-05-21 Thread Sam Chand
Hello R-users, I am trying to obtain Type III SS for an ANOVA with subsampling. My design is slightly unbalanced with either 3 or 4 subsamples per replicate. The basic aov model would be: fit <- aov(y~x+Error(subsample)) But this gives Type I SS and not Type III. But, using the drop() option: dr