[R] plot(): I want to display dates on X-axis.

2007-03-04 Thread d. sarthi maheshwari
Hi,

I want to display dates on my x-axis of the plot. I was trying to use plot()
command for the same and passing the values in following manner:

The variable "dat" is a data frame. The first column has numeric values and
second column has date.

e.g. dat

 [,1]dat[,2]

[1,]300   20060101
[2,]257   20060102
[3,]320   20060103
[4,]311   20060104
[5,]297   20060105
[6,]454   20060106
[7,]360   20060107
[8,]307   20060108



the command I am performing is::

plot(x=dat[1], y=as.character(dat[2]))


Kindly suggest some method by which I can perform my task of displaying the
first column values on y-axis against dates on x-axis.

-- 
Thanks & Regards
Sarthi M.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] R software to place points on Yahoo maps

2007-03-04 Thread Gabor Grothendieck
Hi, Your response to my post was EXTREMELY useful.

For georegistering I used the site:

   http://www.runningmap.com

which lets one click on a a Yahoo! map and get lat/long in lower right.
As my data is in UTM I converted the lat/long to UTM using:

   http://home.hiwaay.net/~taylorc/toolbox/geography/geoutm.html

Then using locator() in R I picked out the corresponding points on the
R image that I had created using your code.  That allowed me to
calculate the inputs for GridTopology (are there any convenience functions
to assist in this? -- I found it a bit error prone)

(I actually noticed that there is a lat/long in Yahoo! map URLs so it might
be that if the maps are a known width and height that one could georegister
them based only on that.)

At any rate I seem to be having some success with this.  Thanks !!!


On 3/4/07, Michael Sumner <[EMAIL PROTECTED]> wrote:
> > Is there any R software that create an image from Yahoo maps together
> > with points of known UTM coordinates (or lat/long marked? Note that my
> > region of interest is not covered in sufficient detail by Google maps.
> > It actually does not have to be Yahoo maps as long as it has
> > sufficient coverage of my region but that's the one I have found with
> > coverage of my region. The scale I am interested in is a city block.
> > Thanks.
>
> rgdal in combination with sp. You'll need to georegister the image, as
> the yahoo maps interface is unlikely to provide a format supporting this
> metadata, but you can do that easily with two reference coordinates.
>
> The workflow might go like this (untested).  You could continue the
> query on R-Sig-Geo. Hope this helps.
>
> There are freely available tools for reading image data directly from
> Yahoo, Google and Virtual Earth in georeferenced
> versions, but I've only used them via commercial GIS. If you can
> describe the map you want I'd be interested in
> exploring that option.
>
> Cheers, Mike.
>
> library(rgdal)
> im <- readGDAL("yahooMap.png")  ## a file saved from Yahoo Maps
>
> ## create index for RGB colours
> col <- SGDF2PCT(im)  ## im is a spatialGridDataFrame with 3 bands
>
> im$ind <- col$idx  ## add the colour index to the data frame
>
> image(im, "ind", col = col$ct)
>
> ## BUT you won't be able to plot UTM on this yet
>
> ## you'll need to create a new GridTopology with appropriate
> cellcentre.offset and cellsize
>
> ogt <- getGridTopology(im)
> . . . find values for offsets and pixel size
>
> gt <- GridTopology(cc.offset, csize,  [EMAIL PROTECTED])
>
> ## recreate the object
> im <- SpatialGridDataFrame(gt, [EMAIL PROTECTED])
>
> image(im, "idx", col = col$ct)
> points(utm.x, utm.y)  ## etc.
>
> __
> R-help@stat.math.ethz.ch 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-contained, reproducible code.
>

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] lattice histogram

2007-03-04 Thread Aimin Yan
thank you very much.  Your code almost solve my problem, but I have a 
further question.
In my data, there is no observation in some group, I want to label that 
panel by
n=0
hat(m)=NA
hat(s)=NA.

I try to modify your panel function, but it doesn't work out. Do you know 
how to add something to your panel
  function so that it can deal with some group that has 0 observation.

Aimin

At 02:54 AM 3/4/2007, Renaud Lancelot wrote:
>Here is an example using the grid package to annotate the graphs:
>
>library(lattice)
>library(grid)
>resp  <- rnorm(200)
>group <- sample(c("G1", "G2", "G3"), replace = TRUE, size = 100)
>histogram(~ resp | group,
>  panel = function(x, ...){
>std <- round(sd(x), 2)
>n <- length(x)
>m <- round(mean(x), 2)
>panel.histogram(x, ...)
>x1 <- unit(1, "npc") - unit(2, "mm")
>y1 <- unit(1, "npc") - unit(2, "mm")
>grid.text(label = bquote(n == .(n)), x = x1, y = y1, just = "right")
>grid.text(label = bquote(hat(m) == .(m)), x = x1, y = y1 - unit(1,
>"lines"), just = "right")
>grid.text(label = bquote(hat(s) == .(std)), x = x1, y = y1 -
>unit(2, "lines"), just = "right")
>})
>Best,
>
>Renaud
>
>2007/3/4, Aimin Yan <[EMAIL PROTECTED]>:
>>How to add mean,sd, number of observation in each panel for lattice 
>>histogram?
>>
>>Aimin
>>
>>__
>>R-help@stat.math.ethz.ch 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-contained, reproducible code.
>
>
>--
>Renaud LANCELOT
>Département Systèmes Biologiques du CIRAD
>CIRAD, Biological Systems Department
>
>Campus International de Baillarguet
>TA 30 / B
>F34398 Montpellier
>Tel   +33 (0)4 67 59 37 17
>Secr. +33 (0)4 67 59 37 37
>Fax   +33 (0)4 67 59 37 95

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] Scoping issue?

2007-03-04 Thread Thaden, John J
Apparently you're right that colnum doesn't exist when it needs to
be evaluated, but why?  Why is 'paste' being evaluated so early? It is,
after all, the value of an argument ('main') of my mmatplot function
with colnum being another argument.  I thought arguments were lazy-loaded.
Does using mapply change the rules?

Is there a way (like mapply) to loop at some lower level rather than
Explicitly, in the R script, as in your suggestion?  For speed's sake?

Thanks.  -John


On Sunday Mar 4 2007, jim holtman <[EMAIL PROTECTED]> replied 

> First of all, 'colnum' does not exist when the 'paste' is called.  
> This probably does what you want:
 
> for (colnum in 1:ncol(A)){
>     mmatplot(colnum, 1:nrow(A), A, main=paste("Array input, column",
colnum))
> }

 
On 3/4/07, John Thaden <[EMAIL PROTECTED]> wrote: 
Hello, the code below is supposed to be a wrapper for matplot to
do columnwise visible comparison of several matrices, but I'm 
doing something wrong because I can't access an argument called
'colnum'.  I'd be most grateful for some insight.

Thanks,
John
Little Rock, AR
 
# mmatplot is a matplot wrapper to compare the same column of
# several matrices. Arg y is either a list of matrices with
# equal number of rows, or an array. The scalar n gives the
# column of each matrix or array slab to plot. par values and 
# matplot args are accepted, e.g., ylog.  mmatplot is intended
# to be mapply-compatible to test multiple columns.

mmatplot <- function(colnum, x, y, ...){
switch(class(y),
   array = y <- y[, colnum, ], 
   list = y <- sapply(X = y, FUN = subset, select = colnum))
stopifnot(is.matrix(y))
matplot(x, y, ...)
}

#This is just a tester function
mmatplotTest <- function(){
oldmf <- par("mfrow") 
par(mfrow = c(2,3))
A <- array(data = rnorm(90), dim = c(10, 3, 3))
L <- list(A[, , 1], A[, , 2], A[, , 3])

# The 'main' argument below throws the error, but if
# commented out, another error crops up due to 'colnum'. 
# Test with class(y) == "array"
mapply(X = 1:ncol(A), FUN = mmatplot, x = 1:nrow(A), y = A,
main = paste("Array input, column", colnum))
# Test with class(y) == "list" 
mapply(1:ncol(L[[1]]), mmatplot, x = 1:nrow(L[[1]]), y = L,
main = paste("List input, column", colnum))
par(mfrow = oldmf)
}

#Run the test
mmatplotTest()

__ 
R-help@stat.math.ethz.ch 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-contained, reproducible code.



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve? 

Confidentiality Notice: This e-mail message, including any a...{{dropped}}

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


[R] Sehr Geehrter

2007-03-04 Thread [EMAIL PROTECTED]
Sehr Geehrter,

 
Trauriges morgens empfing ich nicht Ihre Antwort. Auch wenn dieser Brief

Sie sicherlich überraschen wird, nehmen Sie sich bitte einen Moment Zeit um
ihn zu lesen. Es ist

sehr wichtig. Ich bin Steve Morgan und ich arbeite bei einer Finanzhaus in
den Niederlanden. 
Ich habe Ihre Adresse durch den International Web Directory Online
gefunden. Während unseres letzten
Treffens und Überprüfung der Bankkontos hat meine Abteilung ein untätiges
Konto mit einer riesigen
Geldsumme, US$6,500,000.00(Sechs Million fünfhundert tausend US Dollar)
gefunden, das
einem unseren gestorbenen 

Kunden gehört: Herr Williams aus England. Er ist gestorben und hat keine
Begünstigten hinterlassen. So dass die Fonds auf seinem Konto untätig
geblieben sind, ohne jeden
Anspruch oder Aktivität für einige Zeit schon.


Wegen unseren Finanzhaus vorschriften kann nur ein Ausländer als
nächster Verwandten stehen und deshalb habe ich mich entschlossen Sie zu
kontaktieren, um mit Ihnen
zusammen zu arbeiten um diese untätigen Fonds zu reaktivieren. Und so jede
negative Entwicklung oder
sogar den endgültigen Verlust der Fonds abzuwenden. In Namen meiner
Kollegen suchen ich Ihre Erlaubnis
als nächster Verwandte unseres verstorbenen Kunden zu stehen, so dass die
Fonds freigestellt
und auf ihr Konto überwiesen werden können. 

Sie würden zum nächsten Verwandten des Begünstigten werden und die Fonds
werden 
in Ihre Verantwortung freigestellt werden. Wir dürfen mit ausländischen
Kontos nicht arbeiten, das könnte in der Zeit der Überweisung auffallen.
Ich arbeite noch bei dieser
Finanzhaus, das ist der eigentliche Grund, dass ich eine zweite Partei oder
Person benötige, um mit mir  zu
arbeiten und Anforderungen als nächster Verwandte zu schicken und auch um
ein Bankkonto bereit zu
stellen, oder eines bei einer neuen Bank zu eröffnen, um die untätige Fonds
zu erhalten.

Am Ende der Transaktion werden Ihnen 40% Prozent zustehen, zur Seite
gelegt und 60% werden für meine Kollegen und mich sein.
Was ich von Ihnen verlange ist als nächster Verwandte des Verstorbenen
zu stehen. Ich besitze alle notwendigen Dokumente um die Transaktion
erfolgreich zu verwirklichen.
Weitere Informationen werden Sie so bald ich Ihre positive Antwort bekomme
erhalten.

Ich schlage Ihnen vor so bald wie möglich mir zu antworten.

Wir haben nicht viel Zeit diese unglückliche Situation zu ändern und ich
befürchte, dass 
ohne Ihre Hilfe alles verloren gehen wird. Wegen der Vertraulichkeit bitte
ich Sie mir auf meine privaten 
Email Adresse mit folgenden Angaben zu antworten: Vollständiger Name,
Adresse, Telefon- und Fax:nummer.

In Erwartung Ihrer Antwort, verbleibe ich,mit freundlichen Gruessen,

Steve Morgan.
[EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


[R] logistic regression on contingency table

2007-03-04 Thread Bingshan Li
Hi folks,

I am wondering if there is a way in R to fit logistic regression on  
contingency table. If I have original data, I can transform the data  
into a design matrix and then call glm to fit the regression. But now  
I have a 2x3 contingency table with first row for response 0 and  
second row for response 1, and the columns are 3 levels of predictor  
variable. The 3 levels are not ordinal though and indicator variables  
would be more appreciate.

Thanks a lot!

Bingshan

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] - Nonparametric variance test

2007-03-04 Thread Ted Harding
On 04-Mar-07 Bernd Dittmann wrote:
> Hi useRs,
> 
> can a variance test for 2 non-normal samples be tested in R? Also, thus
> far I have not been able to find the Friedman two way analysis of
> variance.
> 
> For normal r.v., the var.test is available, but are there any tests 
> available for non-normal samples?
> 
> Thanks!
> 
> Bernd

If you are seeking to test whether two samples have equal "variances",
you might like to consider Tukey's "hijack" of the Mann-Whitney test.

First, relocate one sample so that both have the same median (NOTE
that there may be an implicit assumption here).

Next, pool the samples (retaining identity), just as in Mann-Whitney.
Suppose the result for two samples X and Y (in increasing order) looks
like

  X X Y X Y X X Y Y Y X X Y X Y Y Y Y X Y X X Y X X X  [**]

  A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

where the second row of letters is used as labels.

Then read off the identities of the elements alternately from the
two ends of [**], from the outside in:

  A Z B Y C X D W E V F U G T H S I R J Q K P L O M N

leading to

  X X X X Y X X Y Y X X X X Y Y X Y Y Y Y X Y X Y Y X

and then do a Wilcoxon test (equivalent to Mann-Whitney) on the
result.

Here you may as well allocate the final sequence of X and Y terms
the values 1,2,3,...,26 from left to right:

  X
  [1]  1  2  3  4  6  7 10 11 12 13 16 21 23 26
  Y
  [1]  5  8  9 14 15 17 18 19 20 22 24 25


and then wilcox.test() gives the result

  wilcox.test(x=X,Y)
Wilcoxon rank sum test
  data:  X and Y

  W = 50, p-value = 0.08493
  alternative hypothesis: true mu is not equal to 0 


What this is really testing is whether the X values lie closer
to, or further from, their median than the Y values do relative
to their median. Using the default two-sided alternative, the
P-value is then 0.08493; if you already expected that any difference
would be in the direction of Y closer to median than X, for instance,
then

  wilcox.test(X,Y,alternative="less")
Wilcoxon rank sum test
  data:  X and Y 

  W = 50, p-value = 0.04246
  alternative hypothesis: true mu is less than 0 

since "less" means that the X's tend to occur earlier in the
sequence [**] than the Y's (i.e. tend to occur nearer the ends).

Best wishes,
Ted.


E-Mail: (Ted Harding) <[EMAIL PROTECTED]>
Fax-to-email: +44 (0)870 094 0861
Date: 05-Mar-07   Time: 00:49:43
-- XFMail --

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] plot groupedData in nlme

2007-03-04 Thread Renaud Lancelot
library(nlme)
trellis.par.set(list(superpose.line = list(col = "black")))
plot(Dialyzer, outer = ~QB, key = FALSE, col = "black")

I prefer to use directly xyplot (package lattice) for a finer control.

Best,

Renaud


2007/3/4, Qiong Yang <[EMAIL PROTECTED]>:
> Hi,
>
> Does anyone know how to make the color of the lines all black when
> plotting groupedData with an outer factor:
>
> For example,
> library(nlme)
> plot(Dialyzer, outer=~QB, key=F)
>
> This generated colored curves in R.2.4.1. How to make all the curves black ?
> (or how to alter the color (type) of lines for the nlme groupedData
> plotting function in general?)
>
> Thanks
> Qiong
>
> __
> R-help@stat.math.ethz.ch 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-contained, reproducible code.
>


-- 
Renaud LANCELOT
Département Systèmes Biologiques du CIRAD
CIRAD, Biological Systems Department

Campus International de Baillarguet
TA 30 / B
F34398 Montpellier
Tel   +33 (0)4 67 59 37 17
Secr. +33 (0)4 67 59 37 37
Fax   +33 (0)4 67 59 37 95

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


[R] Trouble figuring messages from rcspline.plot

2007-03-04 Thread Gerard Smits

I have an attached data.frame with a binary composite variable (comp) 
and a predictor (egfr).  I am trying to plot a restricted cubic spline using:


require (Hmisc)
require (Design)

rcspline.plot(x=egfr,y=comp,model="logistic",nk=5,knots=NULL,
   xlab="label1", ylab="Label2",
   plim=c(0,1), plotcl=TRUE,
   showknots=TRUE, add=FALSE, lty=1, noprint=FALSE, smooth=FALSE,
   main="Title goes here ");

I get the following error message (exactly as cut/pated):

Loading required package: package
Error in requirePackage("Design") : This function requires theDesignpackage
In addition: Warning message:
there is no package called 'package' in: library(package, lib.loc = 
lib.loc, character.only = TRUE, logical = TRUE,

Should I be using an additional package?

Any suggestions will be appreciated.  Thanks,

Gerard Smits

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


[R] - Nonparametric variance test

2007-03-04 Thread Bernd Dittmann
Hi useRs,

can a variance test for 2 non-normal samples be tested in R? Also, thus 
far I have not been able to find the Friedman two way analysis of variance.

For normal r.v., the var.test is available, but are there any tests 
available for non-normal samples?

Thanks!

Bernd

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] Scoping issue?

2007-03-04 Thread jim holtman
First of all, 'colnum' does not exist when the 'paste' is called.  This
probably does what you want:

for (colnum in 1:ncol(A)){
mmatplot(colnum, 1:nrow(A), A, main=paste("Array input, column",
colnum))
}



On 3/4/07, Thaden, John J <[EMAIL PROTECTED]> wrote:
>
> Hello, The code below is supposed to be a wrapper for matplot to
> do columnwise visible comparison of several matrices, but I'm
> doing something wrong because I can't access an argument called
> 'colnum'.  I'd be most grateful for some insight.
>
> Thanks,
> John Thaden
> Little Rock, AR
> 
> # mmatplot is a matplot wrapper to compare the same column of
> # several matrices. Arg y is either a list of matrices with
> # equal number of rows, or an array. The scalar n gives the
> # column of each matrix or array slab to plot. par values and
> # matplot args are accepted, e.g., ylog.  mmatplot is intended
> # to be mapply-compatible to test multiple columns.
>
> mmatplot <- function(colnum, x, y, ...){
> switch(class(y),
>array = y <- y[, colnum, ],
>list = y <- sapply(X = y, FUN = subset, select = colnum))
> stopifnot(is.matrix(y))
> matplot(x, y, ...)
> }
>
> #This is just a tester function
> mmatplotTest <- function(){
> oldmf <- par("mfrow")
> par(mfrow = c(2,3))
> A <- array(data = rnorm(90), dim = c(10, 3, 3))
> L <- list(A[, , 1], A[, , 2], A[, , 3])
>
> # The 'main' argument below throws the error, but if
> # commented out, another error crops up due to 'colnum'.
> # Test with class(y) == "array"
> mapply(X = 1:ncol(A), FUN = mmatplot, x = 1:nrow(A), y = A,
> main = paste("Array input, column", colnum))
> # Test with class(y) == "list"
> mapply(1:ncol(L[[1]]), mmatplot, x = 1:nrow(L[[1]]), y = L,
> main = paste("List input, column", colnum))
> par(mfrow = oldmf)
> }
>
> #Run the test
> mmatplotTest()
>
> __
> R-help@stat.math.ethz.ch 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-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


[R] plot groupedData in nlme

2007-03-04 Thread Qiong Yang
Hi,

Does anyone know how to make the color of the lines all black when 
plotting groupedData with an outer factor:

For example,
library(nlme)
plot(Dialyzer, outer=~QB, key=F)

This generated colored curves in R.2.4.1. How to make all the curves black ?
(or how to alter the color (type) of lines for the nlme groupedData 
plotting function in general?)

Thanks
Qiong

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


[R] factor analysis and pattern matrix

2007-03-04 Thread Steven Lacey
Hi, 

 

In a discussion of factor analysis in "Using Multivariate Statistics" by
Tabachnick and Fidell, two matrices are singled out as important for
interpreting an exploratory factor analysis (EFA) with an oblique promax
rotation. One is the "structure matrix". The structure matrix contains the
correlations between variables and factors. However, these correlations may
be inflated because some of the variance in a factor may not be unique to
it. To address this and facilitate the interpretation of factors, the
"pattern matrix" can be calculated as it contains the unique correlations
between variables and factors (that is, the variance shared among factors
has been removed). 

 

Are the loadings returned from factanal() with a promax rotation the
structure or the pattern matrix? How do I calculate which ever one of the
matrices is not returned by factanal?

 

Thanks,

Steve


[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] residuals in lme4 package

2007-03-04 Thread Renaud Lancelot
resid is not yet implemented for GLMMs.

Renaud

2007/3/4, Cristina Gomes <[EMAIL PROTECTED]>:
> Hi,
> I have not been able to calculate residuals in the lme4 package. I've
> been trying the resid() function after I ran a GLMM with the lmer()
> function, but I get an error message that says "residuals are not
> inserted yet". I looked it up in the "help" history and I realized that
> several people have had this problem in the past, related to some bug in
> this function and fixed it usually just by upgrading the lme4 package or
> Matrix package. I did, but it didn't work.
> Does anybody have any idea whats going on? Or could you suggest me
> another way of getting and plotting the residuals?
> Thanks a lot,
> Cristina.
> --
> Cristina Gomes Parisca
> Max Planck Institute for Evolutionary Anthropology
> Primatology
> Deutscher Platz 6
> D-04103 Leipzig, Germany
> Phone: +49 341 3550 220
> Fax: +49 341 3550 299
> E-mail: [EMAIL PROTECTED]
>
> __
> R-help@stat.math.ethz.ch 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-contained, reproducible code.
>


-- 
Renaud LANCELOT
Département Systèmes Biologiques du CIRAD
CIRAD, Biological Systems Department

Campus International de Baillarguet
TA 30 / B
F34398 Montpellier
Tel   +33 (0)4 67 59 37 17
Secr. +33 (0)4 67 59 37 37
Fax   +33 (0)4 67 59 37 95

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


[R] Scoping issue?

2007-03-04 Thread Thaden, John J
Hello, The code below is supposed to be a wrapper for matplot to 
do columnwise visible comparison of several matrices, but I'm 
doing something wrong because I can't access an argument called
'colnum'.  I'd be most grateful for some insight.

Thanks,
John Thaden
Little Rock, AR

# mmatplot is a matplot wrapper to compare the same column of 
# several matrices. Arg y is either a list of matrices with 
# equal number of rows, or an array. The scalar n gives the 
# column of each matrix or array slab to plot. par values and
# matplot args are accepted, e.g., ylog.  mmatplot is intended
# to be mapply-compatible to test multiple columns.

mmatplot <- function(colnum, x, y, ...){
  switch(class(y),
array = y <- y[, colnum, ], 
list = y <- sapply(X = y, FUN = subset, select = colnum))
  stopifnot(is.matrix(y))
  matplot(x, y, ...)
}

#This is just a tester function
mmatplotTest <- function(){
  oldmf <- par("mfrow")
  par(mfrow = c(2,3))
  A <- array(data = rnorm(90), dim = c(10, 3, 3))
  L <- list(A[, , 1], A[, , 2], A[, , 3])

  # The 'main' argument below throws the error, but if
  # commented out, another error crops up due to 'colnum'.
  # Test with class(y) == "array"
  mapply(X = 1:ncol(A), FUN = mmatplot, x = 1:nrow(A), y = A,
 main = paste("Array input, column", colnum))
  # Test with class(y) == "list"
  mapply(1:ncol(L[[1]]), mmatplot, x = 1:nrow(L[[1]]), y = L,
 main = paste("List input, column", colnum))
  par(mfrow = oldmf) 
}

#Run the test
mmatplotTest()

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] Newbie questions about "Wireframe"

2007-03-04 Thread Takatsugu Kobayashi
Rusers:

I have been looking into lattice manual to see how I can delete a plot 
frame and a box frame. I just want to show x label, y label, and the 
actual surface only.
\Is this something I should define in axis.default? And how can I change 
the view perspective like persp(phi=, theta=)? I also added "colorkey" 
but the colors were not the same as the ones used in the actual 
surface How can I synchronize?

What I did was

wireframe(grid$z, shade = 
TRUE,aspect=c(1,0.3),light.source=c(20,0,15),xlab="X",zoom=1,contour=T,par.box=F,axs=F)

Thanks

Taka

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] package installation for windows vista

2007-03-04 Thread Uwe Ligges
See, e.g.,

RSiteSearch("Vista Package")


Uwe Ligges



Jungpin Wu wrote:
> Hi guys,
> 
> How to install selected packages for R 2.4.1 under windows vista?
> 
> Thanks a lot.
> 
> JP
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch 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-contained, reproducible code.

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


[R] residuals in lme4 package

2007-03-04 Thread Cristina Gomes
Hi,
I have not been able to calculate residuals in the lme4 package. I've 
been trying the resid() function after I ran a GLMM with the lmer() 
function, but I get an error message that says "residuals are not 
inserted yet". I looked it up in the "help" history and I realized that 
several people have had this problem in the past, related to some bug in 
this function and fixed it usually just by upgrading the lme4 package or 
Matrix package. I did, but it didn't work.
Does anybody have any idea whats going on? Or could you suggest me 
another way of getting and plotting the residuals?
Thanks a lot,
Cristina.
-- 
Cristina Gomes Parisca
Max Planck Institute for Evolutionary Anthropology
Primatology
Deutscher Platz 6
D-04103 Leipzig, Germany
Phone: +49 341 3550 220
Fax: +49 341 3550 299
E-mail: [EMAIL PROTECTED]

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] lattice histogram

2007-03-04 Thread Mendiburu, Felipe \(CIP\)
Steve,

it says resp  <- rnorm(200) must be resp  <- rnorm(100) 

regards

Felipe

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of steve
Sent: Sunday, March 04, 2007 8:58 AM
To: r-help@stat.math.ethz.ch
Subject: Re: [R] lattice histogram


Hi,

When I tried this the groups had sizes 36 30 34 as expected, but
the annotations "n = " were 68 72 60 - twice as large. I don't 
understand why.

Steve

Renaud Lancelot wrote:
> Here is an example using the grid package to annotate the graphs:
> 
> library(lattice)
> library(grid)
> resp  <- rnorm(200)
> group <- sample(c("G1", "G2", "G3"), replace = TRUE, size = 100)
> histogram(~ resp | group,
>   panel = function(x, ...){
> std <- round(sd(x), 2)
> n <- length(x)
> m <- round(mean(x), 2)
> panel.histogram(x, ...)
> x1 <- unit(1, "npc") - unit(2, "mm")
> y1 <- unit(1, "npc") - unit(2, "mm")
> grid.text(label = bquote(n == .(n)), x = x1, y = y1, just = "right")
> grid.text(label = bquote(hat(m) == .(m)), x = x1, y = y1 - unit(1,
> "lines"), just = "right")
> grid.text(label = bquote(hat(s) == .(std)), x = x1, y = y1 -
> unit(2, "lines"), just = "right")
> })

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] lattice histogram

2007-03-04 Thread steve
Hi,

When I tried this the groups had sizes 36 30 34 as expected, but
the annotations "n = " were 68 72 60 - twice as large. I don't 
understand why.

Steve

Renaud Lancelot wrote:
> Here is an example using the grid package to annotate the graphs:
> 
> library(lattice)
> library(grid)
> resp  <- rnorm(200)
> group <- sample(c("G1", "G2", "G3"), replace = TRUE, size = 100)
> histogram(~ resp | group,
>   panel = function(x, ...){
> std <- round(sd(x), 2)
> n <- length(x)
> m <- round(mean(x), 2)
> panel.histogram(x, ...)
> x1 <- unit(1, "npc") - unit(2, "mm")
> y1 <- unit(1, "npc") - unit(2, "mm")
> grid.text(label = bquote(n == .(n)), x = x1, y = y1, just = "right")
> grid.text(label = bquote(hat(m) == .(m)), x = x1, y = y1 - unit(1,
> "lines"), just = "right")
> grid.text(label = bquote(hat(s) == .(std)), x = x1, y = y1 -
> unit(2, "lines"), just = "right")
> })

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] Sigmoidal fitting

2007-03-04 Thread Bernardo Rangel Tura
On Sat, 2007-03-03 at 16:30 -0500, Cressoni, Massimo (NIH/NHLBI) [F]
wrote:
> I am trying to write a function that fits a sigmoid given a X and Y vector 
> guessing the start parameters.
> I use nls. What I did (enclosed) seems to work well with many data points but 
> if I want to fit small
> vectors like :
> 
> pressure <- c(5,15,9,35,45)
> gas <- c(1000,2000,3000,4000,5000)
> 
> it do not work. The help page says that it do no not work on zero residual 
> data.
> 
> Massimo Cressoni

Hi Massimo

I think which this script solve your question

pressure <- c(5,9,15,35,45)
gas <- c(1000,2000,3000,4000,5000)
plot(gas,pressure)
model.1 <- nls(pressure ~ SSlogis(gas, ASym, xmid, scal)))
coef.sig<-coef(summary(model.1))[,1]
est.p<-coef.sig[1]/(1+exp((coef.sig[2]-gas)/coef.sig[3]))
points(gas,est.p,col=2)


If you need more help just need a mail


-- 
Bernardo Rangel Tura,M.D.,Ph.D
National Institute of Cardiology
Rio de Janeiro - Brazil

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] R software to place points on Yahoo maps

2007-03-04 Thread Michael Sumner
> Is there any R software that create an image from Yahoo maps together 
> with points of known UTM coordinates (or lat/long marked? Note that my 
> region of interest is not covered in sufficient detail by Google maps. 
> It actually does not have to be Yahoo maps as long as it has 
> sufficient coverage of my region but that's the one I have found with 
> coverage of my region. The scale I am interested in is a city block. 
> Thanks.

rgdal in combination with sp. You'll need to georegister the image, as 
the yahoo maps interface is unlikely to provide a format supporting this 
metadata, but you can do that easily with two reference coordinates.

The workflow might go like this (untested).  You could continue the 
query on R-Sig-Geo. Hope this helps.

There are freely available tools for reading image data directly from 
Yahoo, Google and Virtual Earth in georeferenced
versions, but I've only used them via commercial GIS. If you can 
describe the map you want I'd be interested in
exploring that option.

Cheers, Mike.

library(rgdal)
im <- readGDAL("yahooMap.png")  ## a file saved from Yahoo Maps

## create index for RGB colours
col <- SGDF2PCT(im)  ## im is a spatialGridDataFrame with 3 bands

im$ind <- col$idx  ## add the colour index to the data frame

image(im, "ind", col = col$ct)

## BUT you won't be able to plot UTM on this yet

## you'll need to create a new GridTopology with appropriate 
cellcentre.offset and cellsize

ogt <- getGridTopology(im)
. . . find values for offsets and pixel size

gt <- GridTopology(cc.offset, csize,  [EMAIL PROTECTED])

## recreate the object
im <- SpatialGridDataFrame(gt, [EMAIL PROTECTED])

image(im, "idx", col = col$ct)
points(utm.x, utm.y)  ## etc.

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.


Re: [R] lattice histogram

2007-03-04 Thread Renaud Lancelot
Here is an example using the grid package to annotate the graphs:

library(lattice)
library(grid)
resp  <- rnorm(200)
group <- sample(c("G1", "G2", "G3"), replace = TRUE, size = 100)
histogram(~ resp | group,
  panel = function(x, ...){
std <- round(sd(x), 2)
n <- length(x)
m <- round(mean(x), 2)
panel.histogram(x, ...)
x1 <- unit(1, "npc") - unit(2, "mm")
y1 <- unit(1, "npc") - unit(2, "mm")
grid.text(label = bquote(n == .(n)), x = x1, y = y1, just = "right")
grid.text(label = bquote(hat(m) == .(m)), x = x1, y = y1 - unit(1,
"lines"), just = "right")
grid.text(label = bquote(hat(s) == .(std)), x = x1, y = y1 -
unit(2, "lines"), just = "right")
})
Best,

Renaud

2007/3/4, Aimin Yan <[EMAIL PROTECTED]>:
> How to add mean,sd, number of observation in each panel for lattice histogram?
>
> Aimin
>
> __
> R-help@stat.math.ethz.ch 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-contained, reproducible code.
>


-- 
Renaud LANCELOT
Département Systèmes Biologiques du CIRAD
CIRAD, Biological Systems Department

Campus International de Baillarguet
TA 30 / B
F34398 Montpellier
Tel   +33 (0)4 67 59 37 17
Secr. +33 (0)4 67 59 37 37
Fax   +33 (0)4 67 59 37 95

__
R-help@stat.math.ethz.ch 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-contained, reproducible code.