Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Kingsford Jones
) xyplot(y ~ time|ID, data = dat, type = 'l') xyplot(y ~ time, data = dat, group = ID, type = 'l') library(ggplot2) qplot(time, y, data = dat, facets = .~ID, geom = 'line') qplot(time, y, data = dat, group = ID, color = ID, geom = 'line') hth, Kingsford Jones On Mon, Aug 23, 2010 at 1:58 PM, Lei

Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Kingsford Jones
- aggregate(formula = y ~ time, data = dat, FUN = mean) mean.y - cbind(ID = as.factor('mean'), mean.y) dat - rbind(dat, mean.y) dat library(ggplot2) qplot(time, y, data=dat, group = ID, color = ID, geom = c('point', 'line')) best, Kingsford Jones __ R-help@r

Re: [R] trajectory plot (growth curve)

2010-08-23 Thread Kingsford Jones
= 'a' (shorthand for panel.average()) that can be used to good effect in xyplot(), but it creates 'holes' where missing data reside, so taking care of the problem externally at the data level is much cleaner. HTH, Dennis best, Kingsford Jones __ R

Re: [R] Tutorial Tinn-R

2010-07-23 Thread Kingsford Jones
is now my favorite interface to R under Windows. Yesterday I used the document comparison tool for the first time (Tools Differences) ...very nice. Kingsford Jones On Fri, Jul 23, 2010 at 10:55 AM, Bert Gunter gunter.ber...@gene.com wrote: Google on tinn-r tutorial. However, I believe that you

Re: [R] Figures in Latex

2010-07-23 Thread Kingsford Jones
to make the desired within R's plotting device rather than in latex try: par(mfrow = c(3, 2)) and you'll probably want to adjust other mar, parameters as well (e.g. mar, cex.lab, etc). Or, take advantage of the flexibility offered by the graphics package by studying ?layout hth, Kingsford

Re: [R] xtable

2010-07-22 Thread Kingsford Jones
not an xtable solution, but R2HTML::HTML has an impressive list of methods, including HTML.infl: lm.SR - lm(sr ~ pop15 + pop75 + dpi + ddpi, data = LifeCycleSavings) influencia - influence.measures(lm.SR) library(R2HTML) methods(HTML) HTML(influencia, 'influencia.html') and open the html file in

Re: [R] Heterogeneous variance in two-way mixed ANOVA

2010-07-22 Thread Kingsford Jones
Can't give more specific advice without more information (see the posting guide), but I suspect you want to use nlme::lme, specifying a weights argument to adjust for the heterogeneity. Kingsford On Wed, Jul 21, 2010 at 11:10 PM, Kline, Keith A kkli...@gatech.edu wrote: I have heterogeneous

Re: [R] Multilevel survival model

2010-07-22 Thread Kingsford Jones
On Thu, Jul 22, 2010 at 8:23 AM, Christopher David Desjardins desja...@umn.edu wrote: * Please cc me if you reply as I am a digest subscriber * Hi, I am wondering how I can run a multilevel survival model in R? Below is some of my data. head(bi0.test)  childid famid lifedxm     sex      

Re: [R] Indexing by logical vectors

2010-07-20 Thread Kingsford Jones
, Kingsford Jones -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Christian Raschke Sent: Tuesday, 20 July 2010 9:16 AM To: r-help@r-project.org Subject: [R] Indexing by logical vectors Dear R-Listers, My question concerns

Re: [R] Help with Reshaping from Wide to Long

2010-07-20 Thread Kingsford Jones
model or using logit-transformed Accuracy (noting that nothing can retrieve the 'theoretical effects' mentioned in (iv) above, but that may not be of interest), best, Kingsford Jones Very best regards, John -- View this message in context: http://r.789695.n4.nabble.com/Help-with-Reshaping

Re: [R] data from SpatialGridDataFrame

2010-07-20 Thread Kingsford Jones
see ?sp::overlay and section 5.2 of Applied Spatial Data Analysis with R I see there is now also raster::overlay, but I can't claim experience with that funciton (however my impression is that the raster package is a powerful tool for working with potentially very large rasters in R). hth,

Re: [R] xyplot: key inside the plot region / lme: confidence bands for predicted

2010-07-08 Thread Kingsford Jones
://comments.gmane.org/gmane.comp.lang.r.lme4.devel/3291 hope it helps, Kingsford Jones My working example is: library(nlme) library(lattice) Ortho - Orthodont Ortho$year - Ortho$age - 8  # make intercept = initial status Ortho.mix1 - lme(distance ~ year * Sex, data=Ortho,       random = ~ 1

Re: [R] Some questions about R's modelling algebra

2010-07-05 Thread Kingsford Jones
On Fri, Jul 2, 2010 at 8:16 AM, Hadley Wickham had...@rice.edu wrote: ?formula in R 2.9.2 says in para 2: The %in% operator indicates that the terms on its left are nested within those on the right. For example a + b %in% a expands to the formula a + a:b. Ooops, missed that.  So b %in% a =

Re: [R] use of random and nested factors in lme

2010-04-05 Thread Kingsford Jones
regarding notation of these formulas in lme (package nlme)? The help files weren't exactly clear to me on this subject. IMO Pinheiro and Bates' companion book to nlme is a prerequisite for efficient use of their software. hoping this helps, Kingsford Jones What confuses me most, is the use

Re: [R] two questions for R beginners

2010-02-27 Thread Kingsford Jones
objects within R. This was vastly facilitated by the use of str and indexing tools ([, [[, $, @). A mantra for R beginners might be In R we work with objects, and str reveals their essence ;-) Kingsford Jones Rob -Original Message- From: r-help-boun...@r-project.org [mailto:r-help

Re: [R] Use of R in clinical trials

2010-02-21 Thread Kingsford Jones
, TARSIER, ZORILLA, GENSTAT, and STORM, among others. best, Kingsford Jones On Thu, Feb 18, 2010 at 9:05 PM, myrm...@earthlink.net wrote: I am old enough to have lived through this particular transition. Prior to the advent of SAS, trials were analyzed by in-house written programs (usually

Re: [R] population variance and sample variance

2010-02-04 Thread Kingsford Jones
On Tue, Feb 2, 2010 at 10:25 AM, Peng Yu pengyu...@gmail.com wrote: On Mon, Oct 19, 2009 at 12:53 PM, Kingsford Jones kingsfordjo...@gmail.com wrote: sum((x-mean(x))^2)/(n) [1] 0.4894708 ((n-1)/n) * var(x) [1] 0.4894708 But this is not a built-in function in R to do so, right? No because

Re: [R] population variance and sample variance

2010-02-04 Thread Kingsford Jones
at 5:25 PM, Peng Yu pengyu...@gmail.com wrote: On Mon, Oct 19, 2009 at 12:53 PM, Kingsford Jones kingsfordjo...@gmail.com wrote: sum((x-mean(x))^2)/(n) [1] 0.4894708 ((n-1)/n) * var(x) [1] 0.4894708 But this is not a built-in function in R to do so, right? hth, Kingsford

Re: [R] extracting estimated covariance parameters from lme fit

2009-11-16 Thread Kingsford Jones
# ..$ : chr [1:3] Variance StdDev Corr # - attr(*, title)= chr Subject = pdLogChol(1 + age) (sigma2.age - as.numeric(vc[2, 1])) # [1] 0.05126955 hth, Kingsford Jones On Mon, Nov 16, 2009 at 9:25 AM, Green, Gerwyn (greeng6) g.gre...@lancaster.ac.uk wrote: Dear all Apologies in advance

Re: [R] How to display full name for the coefficients/factors in summary()?

2009-11-03 Thread Kingsford Jones
By default orthogonal polynomial contrasts are used for ordered factors. Drop the 'ordered = TRUE' and you will get treatment contrasts. hth, Kingsford Jones On Tue, Nov 3, 2009 at 8:52 AM, Jen-Chien Chang jcch...@andrew.cmu.edu wrote: Hi, I am wondering if there is a way to display the full

Re: [R] Robust ANOVA or alternative test?

2009-11-02 Thread Kingsford Jones
See the nlme library and accompanying book by Pinheiro and Bates. The lme function is appropriate for linear mixed models with normal errors, and the 'weights' argument provides flexible methods for modeling error heterogeneity. hth, Kingsford On Mon, Nov 2, 2009 at 12:10 PM, jinyan fan

Re: [R] Easy method to set user-mode virtual memory space in Windows Vista and 7

2009-10-30 Thread Kingsford Jones
Thank you for the response, Prof Ripley. Some comments below On Fri, Oct 30, 2009 at 9:27 AM, Prof Brian Ripley rip...@stats.ox.ac.uk wrote: On Wed, 28 Oct 2009, Kingsford Jones wrote: I thought I'd share this with the list since it appears to provide a quick fix to some memory problems

Re: [R] how do I plot a regression curve with the data?

2009-10-28 Thread Kingsford Jones
On Wed, Oct 28, 2009 at 9:23 AM, Tom Gottfried tom.gottfr...@wzw.tum.de wrote: ?curve regards, Tom and I was in the process of writing a curve example when I noticed Tom sent this. Here it is: set.seed(777) x - runif(100, 0, 100) y - 10*x + x^2 - .01*x^3 + rnorm(100, 0, 500) fit - lm(y ~ x

[R] Easy method to set user-mode virtual memory space in Windows Vista and 7

2009-10-28 Thread Kingsford Jones
this method *please* post a response. best, Kingsford Jones __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self

Re: [R] lasso plot using LARS

2009-10-27 Thread Kingsford Jones
Within the plot.lars code, change the type argument to matplot from 'b' to 'l': library(lars) myplot.lars - edit(plot.lars) #change type = 'b' to type = 'l' in the call to matplot data(diabetes) object - with(diabetes, lars(x,y)) myplot.lars(object, lty = 1, breaks = FALSE) hth, Kingsford

Re: [R] explalinig the output of my linear model analysis

2009-10-27 Thread Kingsford Jones
...which would complement the apropos fortune from John Fox: library(fortunes) fortune('dangerous') If you give people a linear model function you give them something dangerous. -- John Fox useR! 2004, Vienna (May 2004) On Tue, Oct 27, 2009 at 12:48 PM, Rolf Turner

Re: [R] interpretation of RCS 'coefs' and 'knots'

2009-10-24 Thread Kingsford Jones
Perhaps functional data analysis would be of interest. See, for example, package fda. Kingsford On Fri, Oct 23, 2009 at 4:46 PM, Dylan Beaudette debeaude...@ucdavis.edu wrote: Hi, I have fit a series of ols() models, by group, in this manner: l - ols(y ~ rcs(x, 4)) ... where the series

Re: [R] removing random effect from nlme or using varPower() in nls

2009-10-22 Thread Kingsford Jones
help(gnls, pack=nlme) hth, Kingsford Jones On Thu, Oct 22, 2009 at 4:36 PM, Michael A. Gilchrist mi...@utk.edu wrote: Hello, I've been fitting a random effects model using nlme to some data, but I am discovering that the variation in my random effect is very small.  As a result, I would

Re: [R] Question on mixed effect models with LME

2009-10-21 Thread Kingsford Jones
summary(f2)$corFixed['year.c', '(Intercept)'] # [1] 0 A possibility is that the data are not of the expected classes. What does str(long) report? hth, Kingsford Jones I am puzzled, as I thought centering the time variable should eliminate, or at least strongly reduce, this correlation

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

2009-10-21 Thread Kingsford Jones
Mixed models based on likelihood methods can often handle missing observations within subjects, but they not do well with missing individual elements in the design matrices (think unit nonresponse vs item nonresponse in the survey world). Continuing with the example I recently sent to you

Re: [R] Interpretation of VarCorr results

2009-10-20 Thread Kingsford Jones
of the between group variation for each of the levels of the station factor, as well as for the N slope. hth, Kingsford Jones Thank you a lot in advance for every suggestions you'll give me. Enrico        [[alternative HTML version deleted]] __ R

Re: [R] Interpretation of VarCorr results

2009-10-20 Thread Kingsford Jones
On Tue, Oct 20, 2009 at 5:09 AM, r-quantide r...@quantide.com wrote: [snip] .         Is there any methods/functions to obtain the variance components for the station factor too? (please, give me some references, at least.) Pinheiro and Bates 2000 is (practically) a prerequisite for intelligent

Re: [R] ScatterPlot

2009-10-20 Thread Kingsford Jones
= 3, lty = 3) legend('topleft', c('male', 'female'), lty = 2:3, col = 2:3) For some fancier plots see the ggplot2 examples here: http://had.co.nz/ggplot2/stat_smooth.html hth, Kingsford Jones On Tue, Oct 20, 2009 at 1:20 PM, Marsha Melnyk mmel...@stevens.edu wrote: I am trying to make

Re: [R] population variance and sample variance

2009-10-19 Thread Kingsford Jones
sum((x-mean(x))^2)/(n) [1] 0.4894708 ((n-1)/n) * var(x) [1] 0.4894708 hth, Kingsford On Mon, Oct 19, 2009 at 9:30 AM, Peng Yu pengyu...@gmail.com wrote: It seems that var() computes sample variance. It is straight forward to compute population variance from sample variance. However, I feel

Re: [R] What an element in loading is missing? (princomp)

2009-10-19 Thread Kingsford Jones
Peng, It's generally useful to know the class of the object you are working with, and the methods available for that class. This would have led you to the 'loadings' help page. class(pca_result$loadings) [1] loadings methods(class='loadings') [1] print.loadings* Non-visible functions are

Re: [R] Proper syntax for using varConstPower in nlme

2009-10-18 Thread Kingsford Jones
during optimization. hth, Kingsford Jones Thanks. Mike On Fri, 16 Oct 2009, Dieter Menne wrote: Michael A. Gilchrist wrote: -  nlme(Count ~ quad.PBMC.model(aL, aN, T0), +   data = tissueData, +   weights = varConstPower(form =~ Count

Re: [R] Introduction to mark-recapture analysis in R?

2009-10-13 Thread Kingsford Jones
see https://stat.ethz.ch/pipermail/r-sig-ecology/2008-May/000160.html hth, Kingsford On Tue, Oct 13, 2009 at 6:00 AM, Anne-Katrin Link anne.l...@gmx.de wrote: Normal        0        21                        false        false false MicrosoftInternetExplorer4 Dear R-helpers,          I

Re: [R] How to plot a Quadratic Model?

2009-10-05 Thread Kingsford Jones
see ?curve e.g. qftn - function(x) 1 + 2*x - .1*x^2 curve(qftn, 0, 10) hth, Kingsford On Mon, Oct 5, 2009 at 9:42 AM, Juliano van Melis jvme...@gmail.com wrote: Good day for all, I'm a beginner aRgonaut, thus I'm having a problem to plot a quadratic model of regression in a plot. First I

Re: [R] interpreting glmer results

2009-10-05 Thread Kingsford Jones
On Mon, Oct 5, 2009 at 8:52 AM, Umesh Srinivasan umesh.sriniva...@gmail.com wrote: Hi all, [snip] Fixed effects:             Estimate Std. Error z value Pr(|z|) (Intercept) -138.8423     0.4704  -295.1   2e-16 *** SpeciesCr     -0.9977     0.6259    -1.6  0.11091 SpeciesDb     -1.2140    

Re: [R] interpreting glmer results

2009-10-05 Thread Kingsford Jones
that differ in their random effects. best, Kingsford Jones -- Bert hth, Kingsford Many thanks for any help. Cheers, Umesh Srinivasan, Bangalore, India __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] AIC and goodness of prediction - was: Re: goodness of prediction using a model (lm, glm, gam, brt,

2009-09-11 Thread Kingsford Jones
, using the SS resids you are once again back to a linear transormation of the MSE estimate... Kingsford What do you / other R list members think? Regards On Thursday 03 September 2009 15:06:14 Kingsford Jones wrote: There are many ways to measure prediction quality, and what you choose

Re: [R] Using anova(f1, f2) to compare lmer models yields seemingly erroneous Chisq = 0, p = 1

2009-09-07 Thread Kingsford Jones
On Mon, Sep 7, 2009 at 10:34 AM, Alain Zuurhighs...@highstat.com wrote: rapton wrote: Hello, I am using R to analyze a large multilevel data set, using lmer() to model my data, and using anova() to compare the fit of various models.  When I run two models, the output of each model is

Re: [R] how do I draw this surface -- hand drawn in the attachemtn

2009-09-07 Thread Kingsford Jones
for example... x - y - seq(.1, 2, .1) ftn - function(x, y) x - .25*x^2 z - outer(x, y, ftn) persp(x, y, z, theta = 330, phi = 30) hth, Kingsford On Sun, Sep 6, 2009 at 8:28 AM, Steve Lianogloumailinglist.honey...@gmail.com wrote: Hi, On Sat, Sep 5, 2009 at 5:16 AM, gallon

Re: [R] How Does One Use the Value of Density Function?

2009-09-07 Thread Kingsford Jones
On Mon, Sep 7, 2009 at 12:42 AM, Gundala Viswanathgunda...@gmail.com wrote: How do people usually use the result of density function (e.g. dnorm)? Especially when its value can be greater than 1. What do they do with such density 1? dnorm(2.02,2,.24) [1] 1.656498 There are countless uses.

Re: [R] goodness of prediction using a model (lm, glm, gam, brt, regression tree .... )

2009-09-03 Thread Kingsford Jones
There are many ways to measure prediction quality, and what you choose depends on the data and your goals. A common measure for a quantitative response is mean squared error (i.e. 1/n * sum((observed - predicted)^2)) which incorporates bias and variance. Common terms for what you are looking for

Re: [R] understanding the output from gls

2009-09-02 Thread Kingsford Jones
Effects Monitor Santa Monica Mountains National Recreation Area 401 W. Hillcrest Dr. Thousand Oaks, CA 91360 805-370-2347             Kingsford Jones             kingsfordjo...@g             mail.com

Re: [R] Syntax for crossed random effects in nlme

2009-09-01 Thread Kingsford Jones
Hi Ben, Pinheiro and Bates 2000 is the real documentation for nlme. See the Cell Culture Bioassay example starting on pg 163 for a demonstration of fitting crossed random effects using pdIdent and pdBlocked objects. hth, Kingsford On Tue, Sep 1, 2009 at 6:44 AM, bamselbenam...@gmail.com wrote:

Re: [R] understanding the output from gls

2009-09-01 Thread Kingsford Jones
off-diagonals. hth, Kingsford Jones ##More detailed information ##function calls:  sppl.i.xx = gls(all.all.rch~l10area+newx, data = gtemp, method=ML)  sppl.i.ex = gls(all.all.rch~l10area+newx, data = gtemp, method=ML,              correlation = corExp(c(20,.8), form=~x+y|area, nugget=TRUE

Re: [R] how to generate a random correlation matrix with restrictions

2009-08-29 Thread Kingsford Jones
of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: Kingsford Jones kingsfordjo...@gmail.com Date: Friday, August 28, 2009 10:12 pm Subject: Re: [R] how to generate a random correlation matrix with       restrictions

Re: [R] Google's R Style Guide

2009-08-28 Thread Kingsford Jones
be MakeColName(...) -- I was happy to see promotion of -. Reading code using '=' for both object assignment and argument setting is a little like fingernails on a blackboard...again and again and... -- It's nice that people have made these guides available Kingsford Jones On Fri, Aug 28, 2009

Re: [R] how to generate a random correlation matrix with restrictions

2009-08-28 Thread Kingsford Jones
R - matrix(runif(1), ncol=100) hth, Kingsford Jones On Fri, Aug 28, 2009 at 7:26 PM, Ning Mapnin...@gmail.com wrote: Hi, How can I generate a random 100x100 correlation matrix, R={r_ij}, where about 10% of r_ij are greater than 0.9 Thanks in advance

Re: [R] how to generate a random correlation matrix with restrictions

2009-08-28 Thread Kingsford Jones
at 7:36 PM, Kingsford Joneskingsfordjo...@gmail.com wrote:  R - matrix(runif(1), ncol=100) hth, Kingsford Jones On Fri, Aug 28, 2009 at 7:26 PM, Ning Mapnin...@gmail.com wrote: Hi, How can I generate a random 100x100 correlation matrix, R={r_ij}, where about 10% of r_ij are greater than

Re: [R] R package for Hierarchical Modelling of Multinomial Logistic Regression

2009-07-28 Thread Kingsford Jones
See the Bayesian Task View http://cran.r-project.org/web/views/Bayesian.html which will lead you to the arm and bayesm packages, among others. hth, Kingsford On Tue, Jul 28, 2009 at 1:54 AM, nikolay12nikola...@gmail.com wrote: Hello, I need to implement a hierarchical model for Bayesian

Re: [R] Check functions in package

2009-07-28 Thread Kingsford Jones
a couple more options: ls(package:glmnet) [1] coef.glmnet glmnet jerr nonzeroCoef plot.glmnet [6] plotCoefpredict.elnet predict.glmnet predict.lognet predict.multnet [11] print.glmnet # or ls(pos = 2) [1] coef.glmnet glmnet jerr nonzeroCoef

Re: [R] r2 question

2009-07-28 Thread Kingsford Jones
(plotmath) hth, Kingsford Jones On Sat, Jul 25, 2009 at 6:25 AM, Buckmaster, Sarahs.buckmaster...@aberdeen.ac.uk wrote: Hi everyone, I have a question about calculating r-squared in R. I have tried searching the archives and couldn't find what I was looking for - but apologies

Re: [R] ggplot2 : commands on one line vs two lines.

2009-07-24 Thread Kingsford Jones
() + labs(x=Area, y=Povs) pb1 hth, Kingsford Jones On Thu, Jul 23, 2009 at 5:13 PM, John Kanejrkrid...@yahoo.ca wrote: I have just started using ggplot2 and I seem to be doing something stupid in writing ggplot2 commands on more than one line. In the example below the commands on one line

Re: [R] setting up LMER for repeated measures and how do I get a p value for my fixed effect, group?

2009-07-23 Thread Kingsford Jones
: fit2 - aov(Value ~ Group + Error(SS), data = smallDS) #or library(nlme) fit3 - lme(Value ~ Group, data = smallDS, random = ~1|SS) As you might have suspected from the lmer t-value close to 0, the associated p-value is about .5. hth, Kingsford Jones My subjects are divided into two groups

Re: [R] setting up LMER for repeated measures and how do I get a p value for my fixed effect, group?

2009-07-23 Thread Kingsford Jones
, Kingsford Jones My subjects are divided into two groups (variable GROUP), individual subjects are indicated by the variable SS, Value is the outcome measure, each subject has Value measured three times. I have used the following code: fit1-lmer(Value~Group+(1|SS),data=smallDS) print(fit1

Re: [R] Problem with GroupedData

2009-07-14 Thread Kingsford Jones
is that code is much clearer if modeling and plotting calls do not implicitly rely on a non-standard data structure. hth, Kingsford Jones On Tue, Jul 14, 2009 at 8:54 AM, FMHkagba2...@yahoo.com wrote: Hi, I have an original data frame with 8 columns of variables, which are stored in 'data1

Re: [R] Degree of freedom in the linear mixed effect model using lme function in R

2009-07-10 Thread Kingsford Jones
-models list. hoping it helps, Kingsford Jones On Fri, Jul 10, 2009 at 9:27 AM, Djibril Dayambadjibril.daya...@ess.slu.se wrote: Hello, I would appreciate if somebody could help me clear my mind about the below issues. I have a factorial experiment to study the effects of Grazing and Fire

Re: [R] corspatial

2009-07-09 Thread Kingsford Jones
thinks there are duplicates in lonlat. Have you tried, for example, sum(duplicated(lonlat))? Or you could add a small amount of random noise to one of the coordinates and then see if Initialize will run... hth, Kingsford Jones Thanks! K. __ R

Re: [R] how to read point shp file to R?

2009-07-07 Thread Kingsford Jones
Assuming you are referring to ESRI shapefiles, options can be found in the following packages: maptools, rgdal, and shapefiles See the Spatial Task View for more info: http://cran.r-project.org/web/views/Spatial.html hth, Kingsford On Tue, Jul 7, 2009 at 12:28 PM, Sunnysunshineab...@gmail.com

Re: [R] Using by() and stacking back sub-data frames to one data frame

2009-06-24 Thread Kingsford Jones
try do.call(rbind, yourByList) hth, Kingsford Jones On Wed, Jun 24, 2009 at 9:34 PM, Stephan Lindnerlindn...@umich.edu wrote: Dear all, I have a code where I subset a data frame to match entries within levels of an factor (actually, the full script uses three difference factors do do

Re: [R] Partitioning matrix

2009-06-23 Thread Kingsford Jones
see ?[ and notice the 'drop' argument. So in your example try dat[1, , drop=FALSE] hth, Kingsford On Tue, Jun 23, 2009 at 1:13 AM, Bogasobogaso.christo...@gmail.com wrote: Let say, I have following matrix : dat - matrix(rnorm(40), 2, 20) Now I want to partition this like this :

Re: [R] lapply across using multiple columns

2009-06-23 Thread Kingsford Jones
try: dfr - data.frame(A=rnorm(50), B=runif(50), X=factor(sample(c('L1','L2'),50,repl=TRUE))) by(dfr[, 1:2], dfr$X, mean) hth, Kingsford Jones On Tue, Jun 23, 2009 at 7:57 PM, R_help Helprhelp...@gmail.com wrote: Hi, To set a simple an clear picture of what I'd like to do, here

Re: [R] maps maptools

2009-06-22 Thread Kingsford Jones
Task View http://cran.r-project.org/web/views/Spatial.html and an active spatial mailing list https://www.stat.math.ethz.ch/mailman/listinfo/R-SIG-Geo/ hth, Kingsford Jones On Mon, Jun 22, 2009 at 1:01 PM, John Lipkinsjohn.lipk...@googlemail.com wrote: Hey, A basic question. Is there anyone

Re: [R] Smart way to check if a column with certain name exists in a data.frame

2009-06-22 Thread Kingsford Jones
try: 'x' %in% colnames(df) hth, Kingsford On Mon, Jun 22, 2009 at 9:17 PM, R_help Helprhelp...@gmail.com wrote: Hi, I have a matrix or data.frame (df). When I would like to check if a column named x exists, it becomes my habit to do the following: if (length(which(colnames(df)==x))0) Is

Re: [R] how to apply the dummy coding rule in a dataframe with complete factor levels to another dataframe with incomplete factor levels?

2009-06-20 Thread Kingsford Jones
attr(,contrasts)$f2 [1] contr.treatment hth, Kingsford Jones On Fri, Jun 19, 2009 at 10:13 PM, Sean Zhangseane...@gmail.com wrote: Dear R helpers: Sorry to bother for a basic question about model.matrix. Basically, I want to apply the dummy coding rule in a dataframe with complete

Re: [R] latex subscripts in title of a plot

2009-06-07 Thread Kingsford Jones
Hi Dajiang, try plot(1, main=expression(beta[1])) and, more generally, see ?plotmath or demo(plotmath) Kingsford Jones On Sun, Jun 7, 2009 at 4:43 PM, Dajiang Jeff Liudajiang@gmail.com wrote: Dear All, I want to ask how to make latex symbol \beta_1 into the title of the page

Re: [R] How to google for R stuff?

2009-05-20 Thread Kingsford Jones
position of the firefox search bar so that on my windows box I can Ctrl-Tab to firefox, then Ctrl-K to search R sites. hth, Kingsford Jones On Wed, May 20, 2009 at 3:05 PM, Kynn Jones kyn...@gmail.com wrote: Thank you all very much for the so many useful ideas and resources. KJ

Re: [R] surface interpolating 3d

2009-04-23 Thread Kingsford Jones
, Kingsford Jones On Thu, Apr 23, 2009 at 7:15 AM, calpeda mauro.bias...@calpeda.it wrote: Hi all, When you want to draw a surface with a mathematics program you need of two vectors x and y and a matrix z. Then you plot the surface. For example: x=[1 2 3]; y=[5 6 7]; z=[1 2 3  4 5 6  7 8 9

Re: [R] qqnorm.lme pairs.lme

2009-04-23 Thread Kingsford Jones
The model has multiple levels of random effects, so you need to tell qqnorm.lme which one you're interested in. e.g. qqnorm(m1, ~ranef(., level=1)) hth, Kingsford Jones On Thu, Apr 23, 2009 at 11:03 AM, Patrick Zimmerman patz...@gmail.com wrote: Hello, I am trying to do some plotting

Re: [R] converting histogram to barchart

2009-04-22 Thread Kingsford Jones
. Also, you may need to adjust the ylim and xlim arguments if the densities from your two samples are dissimilar. As for converting the histogram to a bar plot -- I think that's an aberration best left in Excel... hope it helps, Kingsford Jones On Wed, Apr 22, 2009 at 2:56 AM, Thomas Fröjd tfr

Re: [R] Color coded 3D plot

2009-04-21 Thread Kingsford Jones
The attachment didn't come through, but try: example(filled.countour) #or library(lattice) example(levelplot) hth, Kingsford Jones On Tue, Apr 21, 2009 at 9:46 PM, mau...@alice.it wrote: I wonder whether it is possible  in R to generate color-coded 3D plots, like the attached example

Re: [R] Determine the Length of the Longest Word in a String

2009-04-10 Thread Kingsford Jones
, Kingsford Jones shadvlength - lapply(shadvector,nchar) shadmaxind - which.max(shadvlength) ## Maximum element shadmax - nchar(shadvector[shadmaxind]) shadmax [1] 9 Many thanks for your help and suggestions. Shad        [[alternative HTML version deleted

Re: [R] How to handle tabular form data in lmer without expanding the data into binary outcome form?

2009-04-10 Thread Kingsford Jones
See ?lmer and notice model gm1 in the examples. As with glm, a binomial lmer model can have the response specified as a two-column matrix with the columns giving the numbers of successes and failures. hth, Kingsford Jones On Fri, Apr 10, 2009 at 2:48 PM, Sean Zhang seane...@gmail.com wrote

Re: [R] Help plotting image to window without margin

2009-04-08 Thread Kingsford Jones
See 'mar' under ?par e.g., x - y - -100:100 z - outer(x, y, function(x,y) sqrt(x^2 + y^2)) par(mar=c(0,0,0,0)) image(x,y,z) hth, Kingsford Jones On Wed, Apr 8, 2009 at 9:07 PM, Bob Meglen bmeg...@comcast.net wrote: I am using several scripts that employ various packages to process images

Re: [R] re form data for aov()?

2009-03-29 Thread Kingsford Jones
from Alcohol.Spray. There are many other options for setting up the design matrix to test hypotheses of interest, and for making adjustments for multiple testing. Hope that helps, Kingsford Jones On Sun, Mar 29, 2009 at 11:01 AM, Dan Kelley kelley@gmail.com wrote: I'm trying to follow along

Re: [R] Post-hoc and planned comparisons for repeated measures

2009-03-29 Thread Kingsford Jones
Hi Dwight, The answer likely depends on how you are fitting the model. Have a look at the multcomp package and its vignettes to see if it can handle the model class you are interested in. hth, Kingsford Jones On Sun, Mar 29, 2009 at 11:11 AM, Krehbiel, Dwight krehb...@bethelks.edu wrote

Re: [R] Post-hoc and planned comparisons for repeated measures

2009-03-29 Thread Kingsford Jones
combinations of the coefficients to be tested to be 0. Kingsford On Sun, Mar 29, 2009 at 11:57 AM, Kingsford Jones kingsfordjo...@gmail.com wrote: Hi Dwight, The answer likely depends on how you are fitting the model.  Have a look at the multcomp package and its vignettes to see if it can handle

Re: [R] Basic regression output question

2009-03-23 Thread Kingsford Jones
] Error in `[.default`((coef(summary(lm(t(returns2) ~ factors)))[50]), 1, :  incorrect number of dimensions Use of the 'str' function will reveal you are indexing a list element, so try [[50]] rather than [50] hth, Kingsford Jones

Re: [R] Extracting SD of random effects from lme object

2009-03-23 Thread Kingsford Jones
above is: diag(sqrt(getVarCov(fm1))) (Intercept) age 2.3270339 0.2264276 Warning message: In sqrt(getVarCov(fm1)) : NaNs produced And to get the estimate of the error standard deviation: fm1$sigma [1] 1.31004 hth, Kingsford Jones Thanks, Ben

Re: [R] Selecting / creating unique colours for behavioural / transitional data

2009-03-14 Thread Kingsford Jones
, Kingsford Jones if that is any use to help explain where i'm going wrong, it seems to run fine and feeds back just what you noted it would, but i still get the error message as before - if you have any more suggestions i'd be very greatful, i'm sure it is down to me missing something very simple

Re: [R] Selecting / creating unique colours for behavioural / transitional data

2009-03-13 Thread Kingsford Jones
is create my own palette, but i'm having limited success in trying to work out how to do this. Kingsford Jones wrote: Try #install.packages('RColorBrewer') example(brewer.pal, pack='RColorBrewer') hth, Kingsford Jones On Fri, Mar 13, 2009 at 3:20 AM, Ross Culloch ross.cull...@dur.ac.uk

Re: [R] code to find all distinct subsets of size r from a set of size n

2009-03-13 Thread Kingsford Jones
For permutations a couple of options are 'permutations' in package gtools, and 'urnsamples' in package prob hth, Kingsford Jones On Fri, Mar 13, 2009 at 6:35 AM, Dale Steele dale.w.ste...@gmail.com wrote: I'm doing a permutation test and need to efficiently generate all distinct subsets

Re: [R] Selecting / creating unique colours for behavioural / transitional data

2009-03-13 Thread Kingsford Jones
$color.names)) chr [1:4] tomato1 yellow1 green blue hth, Kingsford Ross Kingsford Jones wrote: One option for creating your own palette is #install.packages('epitools') mycols - colors.plot(locator = TRUE) then left-click on 15 colors of your liking and then right-click 'Stop

Re: [R] RES: North Arrow (.png file) on a Map

2009-03-11 Thread Kingsford Jones
Also, see # install.packages('sp') example('spplot', package='sp') Kingsford Jones On Wed, Mar 11, 2009 at 9:38 AM, Greg Snow greg.s...@imail.org wrote: Another possibility is the my.symbols function in the TeachingDemos package.   You can define a polygon of your arrow (or other symbol

Re: [R] repeated measures anova, sphericity, epsilon, etc

2009-03-09 Thread Kingsford Jones
or spatially correlated. Kingsford Jones On Mon, Mar 9, 2009 at 1:15 PM, Paul Gribble pgrib...@uwo.ca wrote: After much research I've listed a couple of ways to do repeated measures anova here: http://gribblelab.org/2009/03/09/repeated-measures-anova-using-r/ including univariate

Re: [R] Zero distance error in corSpatial - correlation structure using lme

2009-03-09 Thread Kingsford Jones
may be difficualt, depending on the spatial layout of your study). I don't know of a regression tool in R that allows for estimation of the spatial correlation strructure at levels higher than than the observations. Kingsford Jones On Mon, Mar 9, 2009 at 7:28 AM, John Poulsen jpoul...@zoo.ufl.edu

Re: [R] lme anova() and model simplification

2009-03-09 Thread Kingsford Jones
, and unfortunately the issues are compounded by the sparseness of your data in the predictor space. hth, Kingsford Jones On Mon, Mar 9, 2009 at 4:44 PM, Menelaos Stavrinides mens...@gmail.com wrote: I am running an lme model with the main effects of four fixed variables (3 continuous and one categorical

Re: [R] ANOVA

2009-03-05 Thread Kingsford Jones
()) plot(f1, distance~fitted(.)|Subject, abline=c(0,1)) intervals(f1) hth, Kingsford Jones any other suggestion on dealing with this problem is welcome. Thanks, -- View this message in context: http://www.nabble.com/ANOVA-tp22353919p22353919.html Sent from the R help mailing list archive

Re: [R] how to create many variables at one time?

2009-03-04 Thread Kingsford Jones
, ..., V100 try dat - as.data.frame(replicate(100, rnorm(10))) hth, Kingsford Jones  Thanks~        [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting

Re: [R] changing font size for y-axis factor labels

2009-03-04 Thread Kingsford Jones
Does cex.axis not work in that it reduces the size for both x and y axes? If that's the case try calling plot with axes=FALSE, and then add axes seperately with the axis function. Kingsford Jones On Wed, Mar 4, 2009 at 1:59 PM, Tiffany Vidal tvi...@mercury.wh.whoi.edu wrote: I am trying

Re: [R] listing functions in base package

2009-03-04 Thread Kingsford Jones
see https://stat.ethz.ch/pipermail/r-help/2008-January/151694.html hth, Kingsford Jones On Wed, Mar 4, 2009 at 7:30 PM, Fuchs Ira irafu...@gmail.com wrote: How can I print the definition of a function that is in the base package? for example, if I type: which.min I get function (x

Re: [R] listing functions in base package

2009-03-04 Thread Kingsford Jones
Thanks. On Mar 4, 2009, at 10:26 PM, Kingsford Jones wrote: see https://stat.ethz.ch/pipermail/r-help/2008-January/151694.html hth, Kingsford Jones On Wed, Mar 4, 2009 at 7:30 PM, Fuchs Ira irafu...@gmail.com wrote: How can I print the definition of a function that is in the base package

Re: [R] output formatting

2009-03-04 Thread Kingsford Jones
[1] 259 -- : H : B [1] 169 hth, Kingsford Jones On Wed, Mar 4, 2009 at 8:17 PM, Pele drdi...@yahoo.com wrote: Hi R users, I have an R object with the following attributes: str(sales.bykey1)  'by' int [1:3, 1:2, 1

Re: [R] object .trPaths not found

2009-02-28 Thread Kingsford Jones
RSiteSearch('trpaths') will lead you to potential solutions... On Fri, Feb 27, 2009 at 7:18 PM, rkevinbur...@charter.net wrote: I am running an R script with Tinn-R (2.2.0.1) and I get the error message Error in source(.trPaths[4], echo = TRUE, max.deparse.length = 150) :  object .trPaths

Re: [R] indexing model names for AICc table

2009-02-25 Thread Kingsford Jones
Aslo note there are a number of packages with functions producing Burnham and Anderson style AIC tables: pgirmess, bbmle, dRedging(off-CRAN), PKtools, ... On Wed, Feb 25, 2009 at 4:58 PM, Mark Drever mdre...@interchange.ubc.ca wrote: hi folks, I'm trying to build a table that contains

Re: [R] windows vs. linux code

2009-02-25 Thread Kingsford Jones
X11() on my Vista machine running 2.8.1 seems to work the same as windows(). From the help page, the only difference I see is that 'X11' (and 'x11') have only width, height and pointsize arguments ('windows' has another 13). Kingsford On Wed, Feb 25, 2009 at 8:58 PM, Ted Harding

Re: [R] Extracting xy from raster based on raster value

2009-02-22 Thread Kingsford Jones
, sample(1:27, ncell(r), replace=1)) plot(r) r[] - r[]==1 plot(r) If you'd rather have the non-1 cells be NA, just replace 'r[]==1' with 'ifelse(r[]==1, 1, NA)' hth, Kingsford Jones On Sat, Feb 21, 2009 at 8:46 AM, Michelle Greve michelle_gr...@yahoo.com wrote: I have a raster (which I called glc

  1   2   >