[R] Three-dimensional contingency table

2010-08-28 Thread Randklev, Charles
Hi, I am trying to assemble a three-way contingency table examining the presence/absence of mussels, water depth (Depth1 and Depth 2) and water velocity (Flow vs. No Flow). I have written the following code listed below; however, when run the glm I get the following message, "Error in model.fr

Re: [R] Question regarding significance of a covariate in a coxme survival model

2010-08-28 Thread Teresa Iglesias
On Sat, Aug 28, 2010 at 8:38 PM, David Winsemius wrote: > > On Aug 27, 2010, at 4:32 PM, Teresa Iglesias wrote: > > Christopher David Desjardins umn.edu> writes: >> >> >>> Hi, >>> I am running a Cox Mixed Effects Hazard model using the library coxme. I >>> am trying to model time to onset (age_s

Re: [R] odd subset behavior

2010-08-28 Thread Joshua Wiley
Dear Erin, -0.50 is greater than -1.00, this means that your logical test returns all FALSE answers. Now consider the results of: x[FALSE] you are selecting none of 'x', hence numeric(0). Perhaps you mean: x[x <= -0.50 & x >= -1.0] HTH, Josh On Sat, Aug 28, 2010 at 7:47 PM, Erin Hodgess w

[R] Please ignore previous stupid question.

2010-08-28 Thread Erin Hodgess
Sorry. -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do re

[R] odd subset behavior

2010-08-28 Thread Erin Hodgess
Dear R People: I just produced the following: x <- seq(-3,3,.01) x[x>= -0.50 & x<= -1.0] numeric(0) x[x>= -0.50 && x<= -1.0] numeric(0) What am I doing wrong, please? This seems strange. Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences Uni

Re: [R] Question regarding significance of a covariate in a coxme survival model

2010-08-28 Thread David Winsemius
On Aug 27, 2010, at 4:32 PM, Teresa Iglesias wrote: Christopher David Desjardins umn.edu> writes: Hi, I am running a Cox Mixed Effects Hazard model using the library coxme. I am trying to model time to onset (age_sym1) of thought problems (e.g. hearing voices) (sym1). As I have siblings

Re: [R] R.matlab package help

2010-08-28 Thread Henrik Bengtsson
Hi. On Sat, Aug 28, 2010 at 3:50 PM, michael wrote: > Henrik, >           OK, finally I got the problem:  I have an  apostrophe in my > windowns 7 user name. That mess up the file name. So I logged in using a > guest account and it works: > > Received cmd: 1 > "eval" string: "B" > B = >   -0.1347

Re: [R] Question regarding significance of a covariate in a coxme survival model

2010-08-28 Thread Teresa Iglesias
Christopher David Desjardins umn.edu> writes: > > Hi, > I am running a Cox Mixed Effects Hazard model using the library coxme. I > am trying to model time to onset (age_sym1) of thought problems (e.g. > hearing voices) (sym1). As I have siblings in my dataset, I have > decided to account fo

[R] maxNR in maxLik package never stops

2010-08-28 Thread Martin Boďa
Greetings, I use maxNR function under maxLik package to find the REML estimates of the parameters of variance components in heteroskedastic linear regression models. I assume that in the model there is additive/multiplicative/mixed heteroskedasticity and I need estimate the respectiv

Re: [R] R.matlab package help

2010-08-28 Thread michael
OK, I think it is just B[1]. Thanks! Michael On Sat, Aug 28, 2010 at 6:50 PM, michael wrote: > Henrik, >OK, finally I got the problem: I have an apostrophe in my > windowns 7 user name. That mess up the file name. So I logged in using a > guest account and it works: > > > Receive

Re: [R] R.matlab package help

2010-08-28 Thread michael
Henrik, OK, finally I got the problem: I have an apostrophe in my windowns 7 user name. That mess up the file name. So I logged in using a guest account and it works: Received cmd: 1 "eval" string: "B" B = -0.1347 Sent byte: 0 Received cmd: 1 "eval" string: "variables = {'B'};" Sen

Re: [R] extracting columns

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 1:24 PM, Laetitia Schmid wrote: Hi, Can anybody show me how to extract all columns in my dataset that are polymorphic? Or phrased in another way I would like to delete all columns that have no more than one letter in it (that are monomorphic). Assuming you read this

Re: [R] extracting columns

2010-08-28 Thread Laetitia Schmid
Wow. That was fast. And it works. Thank you! Laetitia Am 29.08.2010 um 00:35 schrieb Jorge Ivan Velez: > index <- apply(d, 2, function(x) length(table(x)) > 1) > d[, index] [[alternative HTML version deleted]] __ R-help@r-project.org mailin

[R] extracting columns

2010-08-28 Thread Laetitia Schmid
Hi, Can anybody show me how to extract all columns in my dataset that are polymorphic? Or phrased in another way I would like to delete all columns that have no more than one letter in it (that are monomorphic). Thank you. Laetitia "V1" "V2" "V3" "V4" "V5" "V6" "V7" "V8" "V9" "V10" "V11" "

Re: [R] conditionally sum

2010-08-28 Thread RICHARD M. HEIBERGER
See ?table for details. > tmp <- ' yx + 1 1 2008 + 2 1 2008 + 3 0 2008 + 4 0 2009 + 5 1 2009' > data <- read.table(textConnection(tmp), header=TRUE) > data yx 1 1 2008 2 1 2008 3 0 2008 4 0 2009 5 1 2009 > table(data$x, data$y) 0 1 2008 1 2 20

Re: [R] binomial distribution

2010-08-28 Thread tamas barjak
Perfect! Thank You! 2010/8/28 Peter Dalgaard > On 08/28/2010 10:23 PM, tamas barjak wrote: > > Hello! > > > > I need some help. > > How I know it to draw the formula of the binomial distribution? > > > > expr<-expression(P(xi == k) == choose(n, k)* p^k*(1-p)^(n-k)) ---> not > good > > > > on th

[R] nlme help

2010-08-28 Thread Jeffrey Harring
I would like to fit a nonlinear model with "nlme." The model is a nonlinear growth model with five time points: y = X*b + e, where design matrix X is defined as X= | 1 0 | | 1 1 | | 1 k | | 1 2k | | 1 3k | and parameter vector b = (b0, b1). And where "k" is a parameter

[R] conditionally sum

2010-08-28 Thread André de Boer
Hi, Suppose I have a dataframe like: > data yx 1 1 2008 2 1 2008 3 0 2008 4 0 2009 5 1 2009 Now I want to know how much "1" corresponds with 2008 and how much with 2009, the answers are 3 and 1. How can I achieve this? Thanks for the anwer. André [[al

Re: [R] R.matlab package help

2010-08-28 Thread Henrik Bengtsson
Michael, could you please give me *verbatim* details on what messages you are seeing. In your previous reply you did *not* report seeing "save(tmpname, '-V6', 'B');" and now you say you get it. Please do not abbreviate what you are getting (e.g. "save(temp,-v6,B)"), because that will not be usef

Re: [R] expression() and plot title

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 4:48 PM, Sancar Adali wrote: My function is like this sim.res<-gaussian_simulation(p=3, r=4, q=3, c=0.1,d=2, Wchoice = "avg", pre.scaling = TRUE, oos = TRUE, alpha = NULL, n = 100, m = 100, nmc = 100) which is defined as gaussian_simulation <- function(p,

Re: [R] R.matlab package help

2010-08-28 Thread michael
Henrik, Yes I replaced the MatlabServer.m and restarted Matlab and R, it seems the problem is still there. I see save(temp,-v6,B) there too. I use MatlabServer.m mannually in Matlab, actually I couldn't use it in R, Matlab will pop up a command window and never respond. Thanks, Michael

Re: [R] expression() and plot title

2010-08-28 Thread Sancar Adali
My function is like this sim.res<-gaussian_simulation(p=3, r=4, q=3, c=0.1,d=2, Wchoice = "avg", pre.scaling = TRUE, oos = TRUE, alpha = NULL, n = 100, m = 100, nmc = 100) which is defined as gaussian_simulation <- function(p, r, q, c, d

Re: [R] binomial distribution

2010-08-28 Thread Peter Dalgaard
On 08/28/2010 10:23 PM, tamas barjak wrote: > Hello! > > I need some help. > How I know it to draw the formula of the binomial distribution? > > expr<-expression(P(xi == k) == choose(n, k)* p^k*(1-p)^(n-k)) ---> not good > > on the screen the "choose(n, k)" not the Binomial Formula, but "choose(

Re: [R] binomial distribution

2010-08-28 Thread Cuckovic Paik
try: ?pbinom -- View this message in context: http://r.789695.n4.nabble.com/binomial-distribution-tp2398568p2398705.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listin

Re: [R] R.matlab package help

2010-08-28 Thread Henrik Bengtsson
Hi. On Fri, Aug 27, 2010 at 7:08 PM, michael wrote: > Henrik, > The line before that is: > > Received cmd: 2 > save > C:\Users\FAN'S~1\AppData\Local\Temp\tpe2b4012b_f9ed_402d_af0f_f21ebd8116a6.mat > -V6 B You should see have seen something like: save(tmpname, '-V6', 'B'); For some reas

[R] binomial distribution

2010-08-28 Thread tamas barjak
Hello! I need some help. How I know it to draw the formula of the binomial distribution? expr<-expression(P(xi == k) == choose(n, k)* p^k*(1-p)^(n-k)) ---> not good on the screen the "choose(n, k)" not the Binomial Formula, but "choose(n, k)" Thanx! [[alternative HTML version deleted]]

Re: [R] AIC using nls function

2010-08-28 Thread Ben Bolker
Bert Gunter gene.com> writes: > > John: > > 1. As always, and as requested (see posting guide), a small > reproducible example might help. Bert is right that things aren't well defined. However, AIC is still *widely* used for nonlinear models. For the sloppy folks among us, here are some u

Re: [R] R.matlab package help

2010-08-28 Thread Ben Bolker
michael gmail.com> writes: > > C:\Users\FAN'S~1\AppData\Local\Temp\tpe2b4012b_f9ed_402d_af0f_f21ebd8116a6.mat > -V6 B I bet the problem is with the single quote (') in the path. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/list

Re: [R] Non-standard sorts on vectors

2010-08-28 Thread Cheng Peng
The following code shows that the unlisted data frame assigns an index to each member. When one sorts the data frame based on ULST, he in fact uses the (implicit) indices of ULST but not the actual values! Therefore, your guess is correct. > test.vec=data.frame(c("A","F","C")) > ULST=unlist(test.

Re: [R] About plot graphs

2010-08-28 Thread Greg Snow
Gavin gave some problems with relying attaching data, here is another example, somewhat artificial, but not unrealistic (I had similar to this happen to me before I learned better): attach(women) # do some stuff library(lattice) attach(singer) # do some more stuff # now we want to go back and l

Re: [R] how to un-crosstabulate data without changing numeric values to text?

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 11:31 AM, David Winsemius wrote: On Aug 28, 2010, at 6:07 AM, Nevil Amos wrote: I have a large amount of data read in from over 140 excel files in the format of x. r1 to r5 are repeat measures for a given Wavelength and ANWC_NO. I need to rearrange x into 3 columns,

Re: [R] About plot graphs

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 9:15 AM, Stephen Liu wrote: Hi Gavin, Lot of thank for your detail explanation. Just looked at; ?with ?within Both "Evaluate an Expression in a Data Environment" Usage: Both; with(data, expr, ...) within(data, expr, ...) Details: . ‘within’ is similar, e

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 11:32 AM, Cuckovic Paik wrote: Thank you very much, David; for row swapping: R2<==>R3 A=diag(1:4) A [,1] [,2] [,3] [,4] [1,]1000 [2,]0200 [3,]0030 [4,]0004 A1=A[c(1,3,2,4),] A1 [,1] [,2] [,3] [,4]

Re: [R] How to plot an expression-label with variable text (lattice variant)

2010-08-28 Thread Dieter Menne
For the record: lattice behaves slightly differently, it requires an "as.expression" with bquote. Dieter plotExp <- function(what) { plot.new() lab = bquote(Estimated~t[50]~ from ~.(what) ) ; text(0.5,0.2,lab) } plotExp("tgv") library(lattice) plotLattice <- function(what) { lab = bquot

[R] NLME question...

2010-08-28 Thread Jeffrey Harring
I would like to fit a nonlinear model with "nlme." The model is a nonlinear growth model with five time points: y = X*b + e, where design matrix X is defined as X= | 1 0 | | 1 1 | | 1 k | | 1 2k | | 1 3k | and parameter vector b = (b0, b1). And where "k" is

[R] star models

2010-08-28 Thread malda
Hi, I am traying to implement an STAR model, but I have some problems. I am following the instruction of the model, that they are in: http://bm2.genes.nig.ac.jp/RGM2/R_current/library/tsDyn/man/star.html that they are from: http://bm2.genes.nig.ac.jp/RGM2/pkg.php?p=tsDyn The model is: star(x,

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread Cuckovic Paik
Thank you very much, David; for row swapping: R2<==>R3 > A=diag(1:4) > A [,1] [,2] [,3] [,4] [1,]1000 [2,]0200 [3,]0030 [4,]0004 > A1=A[c(1,3,2,4),] > A1 [,1] [,2] [,3] [,4] [1,]1000 [2,]0030

Re: [R] how to un-crosstabulate data without changing numeric values to text?

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 6:07 AM, Nevil Amos wrote: I have a large amount of data read in from over 140 excel files in the format of x. r1 to r5 are repeat measures for a given Wavelength and ANWC_NO. I need to rearrange x into 3 columns, ANWC_NO,Wavelegth, value ie ANWC_NOWavelength

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 10:12 AM, (Ted Harding) wrote: On 28-Aug-10 13:15:47, Cuckovic Paik wrote: Thank all help help. Ted's intuitive single step definition is what I want. I try to teach elementary Linear Algebra using R to manupilate matrices. Since my students have no programming experience a

[R] nlme question

2010-08-28 Thread Jeffrey Harring
I would like to fit a nonlinear model with "nlme." The model is a nonlinear growth model with five time points: y = X*b + e, where design matrix X is defined as X= | 1 0 | | 1 1 | | 1 k | | 1 2k | | 1 3k | and parameter vector b = (b0, b1). And where "k" is

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread Ted Harding
On 28-Aug-10 13:15:47, Cuckovic Paik wrote: > Thank all help help. Ted's intuitive single step definition > is what I want. > I try to teach elementary Linear Algebra using R to manupilate > matrices. > Since my students have no programming experience at all, any fancy and > muliple step definitio

Re: [R] Band-wise Sum

2010-08-28 Thread Vincy Pyne
Dear David Sir, Thanks a lot for your guidance. You reply besides helping, also taught me the importance of sharing your knowledge. It also helped me understand where do I stand. I am a starter in R and I have started going through at least some mails everyday whenever possible so that I can le

Re: [R] How to define new matrix based on an elementary row operation in a single step?

2010-08-28 Thread Cuckovic Paik
Thank all help help. Ted's intuitive single step definition is what I want. I try to teach elementary Linear Algebra using R to manupilate matrices. Since my students have no programming experience at all, any fancy and muliple step definition in matrix row operation will confuse them. Again, I a

Re: [R] About plot graphs

2010-08-28 Thread Stephen Liu
Hi Gavin, Lot of thank for your detail explanation. Just looked at; ?with ?within Both "Evaluate an Expression in a Data Environment" Usage: Both; with(data, expr, ...) within(data, expr, ...) Details: . ‘within’ is similar, except that it examines the environment after

Re: [R] How to define new matrix based on an elementary row oper

2010-08-28 Thread Ted Harding
On 28-Aug-10 11:27:30, Gabor Grothendieck wrote: > On Sat, Aug 28, 2010 at 1:32 AM, Cheng Peng > wrote: >> >> Sorry for possible misunderstanding: >> >> I want to define a matrix (B) based on an existing matrix (A) in a >> single >> step and keep A unchanged: >> >>> #Existing matrix >>> A=matrix(1

Re: [R] How to define new matrix based on an elementary row operation in a single step?

2010-08-28 Thread Gabor Grothendieck
On Sat, Aug 28, 2010 at 1:32 AM, Cheng Peng wrote: > > Sorry for possible misunderstanding: > > I want to define a matrix (B) based on an existing matrix (A) in a single > step and keep A unchanged: > >> #Existing matrix >> A=matrix(1:16,ncol=4) >> A >     [,1] [,2] [,3] [,4] > [1,]    1    5    9

[R] how to un-crosstabulate data without changing numeric values to text?

2010-08-28 Thread Nevil Amos
I have a large amount of data read in from over 140 excel files in the format of x. r1 to r5 are repeat measures for a given Wavelength and ANWC_NO. I need to rearrange x into 3 columns, ANWC_NO,Wavelegth, value ie ANWC_NOWavelength r1 ANWC_NOWavelength,r2 ANWC_NOWavelengt

Re: [R] How to define new matrix based on an elementary row operation in a single step?

2010-08-28 Thread Dennis Murphy
Hi: Here are some functions for computing elementary matrices so that you can do Gauss elimination the hard way (the easy way is the LU decomposition, but I digress) I wouldn't use these for serious work, since there are no checks for matrix instability, but the essential ideas are there. It

[R] problem after repackaging

2010-08-28 Thread Samy Khezami
Hy, I had a mistake on a function of a package i have created! I have solved it and then i repackaged and installed the modified package. I use to launch R from Excel! And so when i launch R, and next call my function from the workspace, i still find the problem on my function. And when i read on m

Re: [R] How to define new matrix based on an elementary row operation in a single step?

2010-08-28 Thread David Winsemius
On Aug 28, 2010, at 2:54 AM, Joshua Wiley wrote: Is this sufficiently single steppish for you? D <- A <- matrix(1:16, 4) D[3, ] <- 2 * D[1, ] + D[3, ] # Alternately, you could do this # but it is much messier, and I do not see how # two steps is really an issue # you want to end up with two m

Re: [R] Shifting of Principal amount while calculating Present Value

2010-08-28 Thread Allan Engelhardt
Matrix operations work "the other way" to what you expect on rows and columns. Try ## Your data: time <- c(1, 2, 3) # Please don't use `t' as a variable name cash_flow <- c(7, 7, 107) zero_rate <- data.frame(rating=factor(c("AAA","AA","A","B")), year1=c(3.60, 3.65, 3.72

Re: [R] Calculating p and q values with R

2010-08-28 Thread Peter Dalgaard
On 08/28/2010 03:10 AM, ndar wrote: > > Hi, > I have a huge dataset (53 million records). I have to calculate the p and q > values of my data. How can I do it in R or perl? I have downloaded R (I'm > completely new to R). and the package qvalue but I don't understand how can > I call/use qvalue pa

Re: [R] About plot graphs

2010-08-28 Thread Gavin Simpson
On Fri, 2010-08-27 at 22:14 -0700, Stephen Liu wrote: > Hi Gavin, > > > Thanks for your advice and the examples explaining plotting settings. > > The steps on your examples work on my test. > > > > 2) Don't attach() things, you are asking for trouble > > > If a function has a formula method (