Re: [R] [FORGED] Error occurring in "emmeans" package for the two data sets I used. Please help.

2018-01-11 Thread Lenth, Russell V
This seems to be an entirely new question.

The ‘plot.emmGrid()’ function returns a graphic object of class “ggplot” (by 
default) or “lattice” (if called with ‘engine = “lattice”’). You should use the 
provisions in those respective packages (ggplot2 or lattice) to control the 
details of the plot. In the case of lattice, additional arguments are passed 
via ‘...’ in the call. In the case of ggplot, one may “add” other ggplot:: 
functions to modify the plot.

Russ

Russell V. Lenth  -  Professor Emeritus
Department of Statistics and Actuarial Science   
The University of Iowa  -  Iowa City, IA 52242  USA   
Voice (319)335-0712 (Dept. office)  -  FAX (319)335-3017




From: Akhilesh Singh [mailto:akhileshsingh.i...@gmail.com] 
Sent: Wednesday, January 10, 2018 12:45 AM
To: Sal Mangiafico <salvatore.s.mangiaf...@gmail.com>
Cc: Rolf Turner <r.tur...@auckland.ac.nz>; r-help mailing list 
<r-help@r-project.org>; Lenth, Russell V <russell-le...@uiowa.edu>
Subject: Re: [R] [FORGED] Error occurring in "emmeans" package for the two data 
sets I used. Please help.

Thanks for your kind reply. Problem is solved. However, it's "confidence 
interval / treatment comparison plot" is not taking main title. And the fonts 
of axes labels can not be changed using 'cex' parameter. I will appreciate if 
you could help in this matter too.

Dr. A. K. Singh

On 09-Jan-2018 8:18 PM, "Sal Mangiafico" 
<mailto:salvatore.s.mangiaf...@gmail.com> wrote:
One way to avoid this error is to create the aov without using the with 
function, but instead use the data= option in the aov function.
That is,
medley2 = aov(diversity ~ zinc, data=medley.clementis)
emmeans::emmeans(medley2, "zinc")
You can see the difference in the calls:
medley2$call
medley.clementis.aov$call
This works for the other data set as well, e.g.
keough2 = aov(serpulid.ln ~ biofilm, data=keough.raimondi.ln)
~ Sal Mangiafico

On 1/8/2018 4:44 PM, Rolf Turner wrote:

On 07/01/18 02:19, Akhilesh Singh wrote: 


I am a Professor of Statistics at Indira Gandhi Krishi Vishwavidyalaya, 
Raipur, India. While teaching in class about analysis of variance using R, 
I was doing a one-way analysis for the two data-sets given below in the 
R-class. I got a typical error in "emmeans" package, please help: 

Data-set-1: 
-- 
Medley and Clements (1998) investigated the impact of zinc contamination 
(and other heavy metals) on the diversity of diatom species in the USA 
Rocky Mountains. The diversity of diatoms (number of species) and degree of 
zinc contamination (categorized as either of high, medium, low or natural 
background level) were recorded from between four and six sampling stations 
within each of six streams known to be polluted, as given below: 

stream=c("Eagle", "Eagle", "Eagle", "Eagle", "Blue", "Blue", 
  "Blue", "Blue", "Blue", "Blue", "Blue", "Snake", "Snake", 
  "Snake", "Snake", "Snake", "Arkan", "Arkan", "Arkan", 
  "Arkan", "Arkan", "Arkan", "Arkan", "Chalk", "Chalk", 
  "Chalk", "Chalk", "Chalk", "Splat", "Splat", "Splat", 
  "Splat", "Splat", "Splat") 

zinc=c("BACK", "HIGH", "HIGH", "MED", "BACK", "HIGH", "BACK", "BACK", 
    "HIGH", "MED", "MED", "BACK", "MED", "HIGH", "HIGH", "HIGH", 
    "LOW", "LOW", "LOW", "LOW", "MED", "MED", "LOW", "LOW", 
    "HIGH", "HIGH", "MED", "LOW", "BACK", "BACK", "MED", "LOW", 
    "MED", "BACK") 

diversity=c(2.27, 1.25, 1.15, 1.62, 1.7, 0.63, 2.05, 1.98, 1.04, 
 2.19, 2.1, 2.2, 2.06, 1.9, 1.88, 0.85, 1.4, 2.18, 1.83, 
 1.88, 2.02, 1.94, 2.1, 2.38, 1.43, 1.37, 1.75, 2.83, 
 1.53, 0.76, 0.8, 1.66, 0.98, 1.89) 

medley.clementis=data.frame(stream,zinc,diversity) 

I did the one-way anova: 
--- 

medley.clementis.aov=with(medley.clementis, aov(diversity ~ zinc)) 

anova(medley.clementis) 

Then, I tried to do post hoc analysis using "emmeans" package following 
command: 
---
 

emmeans::emmeans(medley.clementis.aov, "zinc") 


This gives following error: 
-- 
Error in recover_data.call(fcall, delete.response(terms(o

[R] Weight, weight - do tell me

2014-07-21 Thread Lenth, Russell V
This is a question only about terminology.

Suppose I have data categorized by three factors A, B, and C, with cell means 
ybar_ijk and cell frequencies n_ijk, where I, j, and k index A, B, and C 
respectively. And suppose I want to summarize the results for factor A by 
computing some sort of weighted means WM_i, averaging over indices j and k with 
weights w_jk. Consider these four weighting schemes:

1. Use equal weights, w_jk = 1
2. Use weights of w_jk = n_+jk   (where + shows I summed over that index)
3. Use weights w_jk = n_+j+ * n_++k   (outer product of the one-factor 
marginal frequencies)
4. Use weights w_ijk = n_ijk   (only one where we use a different set of 
weights for each i)

Scheme 1 yields the unweighted or least-squares means, and scheme 4 yields 
the ordinary means for A, ignoring B and C altogether. Scheme 3 yields weighted 
averages over k of weighted averages over j (or vice versa).

My question is what to call these schemes, e.g., as a character argument in an 
R function. Preliminarily, I am calling them equal, proportional, outer, 
and actual. The first one is pretty obvious. But maybe there is some existing 
standard terminology for some or all of the others that I am unaware of (or 
have forgotten). Any suggestions?

Russ

Russell V. Lenth  -  Professor Emeritus
Department of Statistics and Actuarial Science   
The University of Iowa  -  Iowa City, IA 52242  USA   
Voice (319)335-0712 (Dept. office)  -  FAX (319)335-3017

__
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-contained, reproducible code.