[R] Graphics function question

2008-07-29 Thread Peter Flom
Hello I have created a graph using the following commands: <<< startBReP3O1T <- diffs$BReP3O1T - diffs$diff_BReP3O1T endBReP3O1T <- diffs$BReP3O1T x <- seq(47,89, length = 10) ymin <- min(min(startBReP3O1T), min(endBReP3O1T)) ymax <- max(max(startBReP3O1T), max(endBReP3O1T)) y <- seq(ymin, ymax,

[R] Simple programming problem with 'with' or 'data ='

2008-08-27 Thread Peter Flom
Hello I wrote a simple program to modify a boxplot: <<< gdsbox <- function(indvar){ boxplot(indvar~gds3lev, main = paste('Boxplot of', substitute(indvar), "for GDS groups"), names = c('1', '3', '4, 5, 6')) } >>> If I attach the dataframe gdsgraph, this works fine. However, I've been war

[R] A question about digest mode

2009-07-10 Thread Peter Flom
Good morning I recently shifted to digest mode; I get the digest each day (sometimes two in a day) and when I open the first file it opens as a text file with a list of topics; but then it is hard to find the right message. In a list of 100 or so links, counting to find link number 53 or whatev

[R] Question on mixed effect models with LME

2009-10-21 Thread Peter Flom
Good afternoon Using R 2.9.2 on a machine running Windows XP I have a longitudinal data set, with data on schools and their test scores over a four year period. I have centered year, and run the following m1.mod1 <- lme(fixed = math_1 ~ I(year-2007.5)*TFC_, data = long,

[R] Missing data and LME models and diagnostic plots

2009-10-21 Thread Peter Flom
Hello Running R2.9.2 on Windows XP I am puzzled by the performance of LME in situations where there are missing data. As I understand it, one of the strengths of this sort of model is how well it deals with missing data, yet lme requires nonmissing data. Thus, m1.mod1 <- lme(fixed = math_

Re: [R] Missing data and LME models and diagnostic plots

2009-10-21 Thread Peter Flom
I wrote >>> I am puzzled by the performance of LME in situations where there are >>> missing data. As I >>> understand it, one of the strengths of this sort of model is how well it >>> deals with missing >>> data, yet lme requires nonmissing data. > Mark Difford replied >You are confusing mi

Re: [R] Boxplot with grouped data

2009-10-22 Thread Peter Flom
Paul Smith wrote > >Is there some way of drawing a boxplot, with R, when one does not have >the original continuous data, but only the data grouped in classes? >The function boxplot() can only deal with original data. It's not clear how the data are, now. What are the classes? Are they numbers?

Re: [R] Bayesian regression stepwise function?

2009-10-22 Thread Peter Flom
Frank E Harrell Jr wrote >Ben Bolker wrote: >> >> >> Allan.Y wrote: >>> Hi everyone, >>> >>> I am wondering if there exists a stepwise regression function for the >>> Bayesian regression model. I tried googling, but I couldn't find >>> anything. I know "step" function exists for regular stepwi

Re: [R] Bayesian regression stepwise function?

2009-10-23 Thread Peter Flom
Ravi Varadhan wrote > >I have heard this (i.e. only head-to-head comparisons are valid) and various >other folklores about AIC and BIC based model selection before, including >one that these information criteria are only applicable for comparing two >nested models. > >Where has it been demonstra

Re: [R] Invert the sign of a number

2009-10-29 Thread Peter Flom
Fran100681 wrote > >just a simple question > >How can I do to invert the sign of a number? (for example: -4 to 4, 2 to -2 >and so on..) >I was looking for a specific function in R but I didn't found it... >thank you > Is there something wrong with *-1 ? Peter Peter L. Flom, PhD Statistical Cons

Re: [R] qqplot

2009-11-02 Thread Peter Flom
David Winsemius wrote >I always assumed that the intercept was zero and the slope = unity. > > y <- rt(200, df = 5) > qqnorm(y); qqline(y, col = 2) > qqplot(y, rt(300, df = 5)) > abline(0, 1, col="red") > Suppose you have the following x <- rnorm(500) y <- 500*(x + runif(500, 0,1)) qqplot(x,

Re: [R] qqplot

2009-11-02 Thread Peter Flom
carol white wrote >So the conclusion is that abline(0,1) should always be used and if it doesn't >go through the qqplot, the two distributions are not similar? I think it depends what you mean by "similar". E.g., if you mean "are both of these distributions (e.g.) normal?" then abline(0,1) is

Re: [R] qqplot

2009-11-02 Thread Peter Flom
John Fox wrote > >I assumed that Carol wanted to compare the shapes of the distributions and >to adjust for differences in centre and spread. To put a line through the >quartiles or to base a line on the medians and IQRs is more robust than >using the means and sds. > Hi John Indeed it is. It al

Re: [R] qqplot

2009-11-02 Thread Peter Flom
Peter Ehlers wrote > >That's not what qqline() does and for good reason - it treats >x and y asymmetrically. > >But qqline() is a very simple function, using the quartiles >as also suggested by John. Here's a modified version that >should work for Carol: > >qqline2 <- function (x, y, ...) >{ >

[R] Variable selection in NLME or LME4

2009-11-04 Thread Peter Flom
Good morning I am learning about NLME and LME4, using Pinheiro and Bates and other materials from Douglas Bates, but I have not seen anything on how to do variable selection sensibly in this type of model. In OLS regression, I frequently use the lasso, but googling did not reveal a method for

[R] Windows 7 editor - I can't make RWinEdt work

2009-11-08 Thread Peter Flom
Good morning I just got a new computer with Windows 7. R works fine, but the editor I am used to using "RWinEdt" does not. I did find one blog post on how to get RWinEdt to work in Windows 7, but I could not get those instructions to work either. Is there a patch for RWinEdt? If not, is the

[R] Problems with latex function on an ols model

2009-11-09 Thread Peter Flom
Good morning I am having problems with the latex function for an ols model from the Design library. When I run: dd <- datadist(bp3) options(datadist = 'dd') spline1 <- ols(data = bp3, AORSP~rcs(Age,3)*P1 + Htm + WtKg + HR + AORMAP) spline1 everything is as expected. But when I try latex(spl

[R] Stat question mixed models with time varying covariate

2009-11-12 Thread Peter Flom
Please xcuse me for being slightly off-topic and cross-posting I have a data set of schools, with scores for 4 years. The goal is to evaluate the effect of an intervention on the scores, accounting for some covariates which are not problematic. The chief problem is that the intervention could

Re: [R] calling R from sas

2009-11-29 Thread Peter Flom
Arnab Maity wrote > > > >I like to call R from SAS. Could you please help me? > There are two methods that I know of: 1) Phil Rack has written a program called A Bridge to R see: http://minequest.com/WordPress/?p=102 2) If you have SAS/IML licensed, you can link to R through IML studio. I

Re: [R] Histogram probabilities >1 ????!!!

2009-12-02 Thread Peter Flom
Trafim wrote > >well, I definitely don't understand anything. >Why the hist function with freq=FALSE gives such a strange result??? > >R <- c(-1.10, 0.79, -1.17, -0.53, -0.26, -0.22, 0.29, -0.26, -0.26, 0.39) >hist(R, freq=FALSE, breaks=10) > The total AREA has to equal 1, which does not mea

[R] Finding cases in one subset that are closet to another subset

2009-12-02 Thread Peter Flom
Good afternoon Running R2.10.0 on Windows I have a data frame that includes (among much else) a factor (In_2006) and a continuous variable (math_3_4). I would like to find the 2 cases for In_2006 = 0 that are closest to each case where In_2006 = 1. My data looks like In_2006 math_3_4

Re: [R] Finding cases in one subset that are closet to another subset

2009-12-02 Thread Peter Flom
David Winsemius wrote > >On Dec 2, 2009, at 3:01 PM, Peter Flom wrote: > >> Good afternoon >> >> Running R2.10.0 on Windows >> >> I have a data frame that includes (among much else) a factor >> (In_2006) and a continuous variable (math_3_4). I wo

Re: [R] Finding cases in one subset that are closet to another subset

2009-12-02 Thread Peter Flom
Thanks Chuck I did not know about that MatchIt. I will check it out Peter -Original Message- >From: Chuck Cleland >Sent: Dec 2, 2009 3:47 PM >To: Peter Flom >Cc: r help >Subject: Re: [R] Finding cases in one subset that are closet to another subset > >On 12/

Re: [R] GLM Question

2009-12-03 Thread Peter Flom
Knut Krueger wrote > >I think this is more an general question to GLMs. > >The result was better in all prior GLMs when I admitted the non >significant factors, but this is the first time that the result is worse >than before. What could be the reason for that? > >glm(data1~data2+data3+data4+data5

Re: [R] Simulation

2009-05-14 Thread Peter Flom
Wacek Kusnierczyk wrote >> Seriously? You think: >> >> lapply(1:n, rnorm, 0, 1) >> >> is 'clearer' than: >> >> x=list() >> for(i in 1:n){ >> x[[i]]=rnorm(i,0,1) >> } >> >> for beginners? >> >> Firstly, using 'lapply' introduces a function (lapply) that doesn't >> have an intuitive name. Also,

Re: [R] Simulation)

2009-05-14 Thread Peter Flom
I wrote As a beginner, I agree the for loop is much clearer to me. Wacek Kusnierczyk replied > >well, that's quite likely. especially given that typical courses in >programming, afaik, include for looping but not necessarily functional >stuff -- are you an r beginner, or a programming

Re: [R] How do you save in R?

2009-05-18 Thread Peter Flom
Dieter Menne wrote >Technically a good point, but I found it helpful for starters who want to >avoid the inferno of "what's attached now?" not to use it at all. >My suggestion is to use with() instead because it has a higher locality. > >I know, many of the examples use attach. As a beginner,

Re: [R] intermediate iterations of stepwise regression

2009-05-18 Thread Peter Flom
utkarshsinghal wrote >> Hi all, >> >> I am performing a stepwise regression by running the "step" function on an >> "lm" object. Now I want to save the intermediate iterations. I know the >> argument trace=T will print it on the console, but I rather want to assign >> it to some R object or may b

Re: [R] minmun p-value for wilcox.test and correlation

2009-05-20 Thread Peter Flom
charles78 wrote >I have a stupid question on how to get the real p-values for wilcox.test and >correlation. the minmun can be reached is 2.2E-16 using the R version >2.6.2. I do not think it is the R version causing this but other issues. > >Any help is highly appreciated. > Can I ask why you

Re: [R] Constraining linear regression model

2009-05-23 Thread Peter Flom
Jean-Paul Kibambe Lubamba wrote > >I have two questions: > >I am computing a linear regression model with 0 as Intercept. > >Well, I would like the sum of my predicted values be equal to a constant >and therefore analyze if my coefficients are significatively different >using or not this constrain

Re: [R] Most used R editors

2009-06-02 Thread Peter Flom
I use WinEct, which is shareware and has a variation just for R, called RWinEdt. Peter -Original Message- >From: Mike Lawrence >Sent: Jun 2, 2009 7:51 AM >To: rhelp >Subject: Re: [R] Most used R editors > >I'm on Mac OS X and I've been using TextMate, though I feel guilty >that it's non

Re: [R] classification table in logistic regression

2009-06-04 Thread Peter Flom
Frank E Harrell Jr wrote >Armida, > >I regret putting CTABLE as an option on the old SAS PROC LOGIS which was >a basis for PROC LOGISTIC. Classification tables are arbitrary and >misleading so I would stay away from them. > >You might build a model with and without the variable of interest and

Re: [R] (no subject)

2009-06-06 Thread Peter Flom
Christophe Genolini wrote >Thanks for yours answers. So if I understand: > - Trajectories are continuous, the other are discrete. > - The difference between time series and longitudinal is that time >series are made at regular time whereas longitudinal are not ? > - Repeated measures are over a

Re: [R] Comparing model fits for NLME when models are not nested

2009-06-12 Thread Peter Flom
Lindsay Banin wrote >Hi there, > >I am looking to compare nonlinear mixed effects models that have different >nonlinear functions (different types of growth curve)embedded. Most of the >literature I can find focuses on comparing nested models with likelihood >ratios and AIC. Is there a way to c

Re: [R] Please Help pairwise.t.test!!

2009-06-12 Thread Peter Flom
Chunhao Tu wrote >Hi R users, >My question is, If I have 3 groups, A, B, C and I know mean of A =20, B=21, >and C=20.5 and I also know the >standard error of A =1.1, B=2.2, C=3.2. Plus, I know A has 30 observations, >B has 78, C has 45. But I do not have the raw data. > >Can I use pairwise.t.tes

Re: [R] Insignificant variable improves AIC (multinom)?

2009-06-13 Thread Peter Flom
Werner Wernersen wrote >Hi, > >I am trying to specify a multinomial logit model using the multinom function >from the nnet package. Now I add another independent variable and it halves >the AIC as given by summary(multinom()). But when I call Anova(multinom()) >from the car package, it tells me

Re: [R] a proposal regarding documentation

2009-06-14 Thread Peter Flom
Patrick Burns wrote >Proposal > >That a new mailing list be established >that pertains exclusively to R documentation. >The purpose of the list would be to discuss >weak sections of the documentation and >establish fixes for those weak spots. > > >Pro > >If it works, there would be better documen

Re: [R] a proposal regarding documentation

2009-06-14 Thread Peter Flom
ostatistics and Informatics >>> University of Maryland School of Medicine Division of Gerontology >>> Baltimore VA Medical Center >>> 10 North Greene Street >>> GRECC (BT/18/GR) >>> Baltimore, MD 21201-1524 >>> (Phone) 410-605-7119 >>> (

Re: [R] a proposal regarding documentation

2009-06-14 Thread Peter Flom
I certainly don't have anything against the WIKI, but I think that the documentation is where the action is, especially for newbies. It's the natural first step when you want to learn about a function or when you get an error message you don't understand. Peter Peter L. Flom, PhD Statistical

Re: [R] a proposal regarding documentation

2009-06-14 Thread Peter Flom
Well, suppose I wanted to suggest changes to some documentation, or write an alternate help file for some function. Where would I put it? Let's say I type, in R, ?median. Now suppose I have suggestions. If I look at http://wiki.r-project.org/rwiki/doku.php?id=&idx=rdoc:base I don't see the m

Re: [R] Recursive partitioning algorithms in R vs. alia

2009-06-19 Thread Peter Flom
"Carlos J. Gil Bellosta" wrote > >I had a conversation with a guy working in a "business intelligence" >department at a major Spanish bank. They rely on recursive partitioning >methods to rank customers according to certain criteria. > >They use both SAS EM and Salford Systems' CART. I have used

Re: [R] SAS-like method of recoding variables?

2009-06-23 Thread Peter Flom
>Dieter Menne wrote: >> IF TYPE='TRUCK' and count=12 THEN VEHICLES=TRUCK+((CAR+BIKE)/2.2); >>> vehicles <- ifelse(TYPE=='TRUCK' & count=12, TRUCK+((CAR+BIKE)/2.2), NA) >>> >>> >> >> Read both versions to an audience, and you will have to admit that this is >> one of the cases where SAS is su

Re: [R] ANOVA/statistics question

2009-04-26 Thread Peter Flom
drmh wrote > >Hello again, >In my situation, I have three variables: pretest, posttest, and cohesion. > >I want to work out the correlation between postest and cohesion. > cor(cohesion, posttest) gives you this. >I looked at multiple sets of data and created ANOVA tables of them. However, >as

Re: [R] truehist and density plots

2009-04-28 Thread Peter Flom
carol white wrote >Consider a vector of 100 elements (attached files). then, > >truehist(b) >lines(density(b[20:50])) > >How is it possible to have density plots of all subsets like b[20:50] within >histogram (without exceeding the max of historgram on y axis)? > I didn't open your attached fi

Re: [R] correlation coefficient

2009-04-29 Thread Peter Flom
Dieter Menne wrote >I noted the "and" was misleading. Read: Good journals like Lancet, >New English and many British Journal of XXX really help you to do >better. I am one of the statistical editors for PLoS Medicine, and I try to help people do better; often, the people take my advice. Somet

Re: [R] Problems producing a simple plot

2009-05-02 Thread Peter Flom
Steve Murray wrote > >I have a data frame of the nature: >I am hoping to plot columns 2 and 3 against Latitude. I understand that you >have to do this by plotting one column at a time, so I have been starting by >attempting the following, but receiving errors: > > >I'm obviously doing someth

Re: [R] Producing a legend successfullly

2009-05-04 Thread Peter Flom
Steve Murray wrote > >I'm attempting to insert a legend into a line graph. I've sorted out the >positioning, but I'm unable to display the sample line and associated colour >to go within the legend box. Instead, under the variable names, the numbers 1, >2, 2, 3 are displayed in a column (with '

Re: [R] General Question about Graphics

2009-05-06 Thread Peter Flom
steve_fried...@nps.gov wrote > >I have encountered a situation with regards to plotting barcharts with >associated error bars. My search for clues on how to accomplish this >turned up some interesting information. Basically, I found that including >error bars with barplots is not desirable and he

Re: [R] Do you use R for data manipulation?

2009-05-06 Thread Peter Flom
Simon Pickett wrote >My institute uses SAS religiously, I am the only R "heathen". > >I have resisted learning to use SAS because I dont see the point after years >of using R and I like being able to do everything using one program. >However, my colleagues maintain that SAS is "better" for prog

[R] Question on lda and predict

2008-06-10 Thread Peter Flom
Hello Using R 2.7.0 on Windows. I am running a linear discriminant analysis as follows discrim1 <- lda(normvar~ mafmahal+ mrfmahal+ mffmahal+ bafmahal+ brfmahal+ cofmahal+ bmfmahal+ cfmahal+ fractmahal+ antmahal+ absmifmahal+ absifmahal, subset = train) prediction <- predict(discri

Re: [R] Question on lda and predict

2008-06-10 Thread Peter Flom
I wrote (in part) > > I am running a linear discriminant analysis as follows > > > discrim1 <- lda(normvar~ mafmahal+ mrfmahal+ mffmahal+ bafmahal+ brfmahal+ > cofmahal+ bmfmahal+ cfmahal+ fractmahal+ antmahal+ absmifmahal+ > absifmahal, subset = train) > prediction <- predict(discr

Re: [R] Question on lda and predict

2008-06-10 Thread Peter Flom
I wrote > Hello > > Using R 2.7.0 on Windows. > > I am running a linear discriminant analysis as follows > > > discrim1 <- lda(normvar~ mafmahal+ mrfmahal+ mffmahal+ bafmahal+ brfmahal+ > cofmahal+ bmfmahal+ cfmahal+ fractmahal+ antmahal+ absmifmahal+ > absifmahal, subset = train)

[R] LDA on pre-assigned training and testing data sets

2008-06-25 Thread Peter Flom
Dear r-help I am trying to run LDA on a training data set, and test it on another data set with the same variables. I found examples using crossvalidation, and using training and testing data sets set up with sample, but not when they are preassigned. Here is what I tried # FIRST SET UP A DA

[R] Question about GCL function

2008-07-02 Thread Peter Flom
Hello again I recently downloaded the gcl package, which "computes a fuzzy rules or tree classifier from data". It is very interesting and is giving good results. However, rather than return a list, it returns a function. Per the example in the documentation: library(gcl) library(datasets)

Re: [R] Stepwise

2008-09-04 Thread Peter Flom
Robin Williams wrote Is there any facility in R to perform a stepwise process on a model, which will remove any highly-correlated explanatory variables? I am told there is in SPSS. I have a large number of variables (some correlated), which I would like to just chuck in to a model and perform