Re: [R] customizing the color and point shape for each line drawn using lattice's xyplot

2007-08-31 Thread Gen

I have succeeded in controlling the line colors and point symbols of each
Method plotted in each frame of my xyplot, using the help files you
suggested so that some methods can be represented by the same color and
distinguished by symbols using the following code (I can not, however, seem
to make the key reflect these color and symbol changes):

#assign colors to each method
lcol - rep(0, 243)
lcol[common$Method==1] - 1 
lcol[common$Method==2] - 2
lcol[common$Method==3] - 3
lcol[common$Method==4] - 6
lcol[common$Method==5] - 4
lcol[common$Method==6] - 4
lcol[common$Method==7] - 5
lcol[common$Method==8] - 5  
lcol[common$Method==9] - 6 

#assign the type of symbol that corresponds to each method
ptype - rep(0, 243)
ptype[common$Method==1] - NA 
ptype[common$Method==2] - NA
ptype[common$Method==3] - NA
ptype[common$Method==4] - 3
ptype[common$Method==5] - 6
ptype[common$Method==6] - 2
ptype[common$Method==7] - NA
ptype[common$Method==8] - NA  
ptype[common$Method==9] - NA 

xyplot(Yvar~ Xvar| Avar * Bvar, data=common.without.Method478,
groups=method.not478.f, type=o, col=lcol, pch=ptype, cex=0.5,
auto.key=list
(text=c(Method 1,Method 2,Method 3,Method 4a,Method 4b,Method
9), points = TRUE, lines = TRUE, col=c(1,2,3,4,4,6), cex=1,
pch=c(NA,NA,NA,6,2,NA)))

The above code obtains the desired plot, and is the closest that I have come
to obtaining the desired key.  Using the above code, within the key, I
obtain the appropriate text and the text is colored such that the text
Method 1 corresponds to the color of method 1 in the plot. The symbol
shape and line color to the right of this text, however, does not change
from its default settings, and therefore does not reflect the plot.  I am
trying to obtain black text with appropriate symbols and appropriately
colored lines to the right. 

Have I misinterpreted the syntax of the atuo.key function?

- Genevieve

-- 
View this message in context: 
http://www.nabble.com/customizing-the-color-and-point-shape-for-each-line-drawn-using-lattice%27s-xyplot-tf4351934.html#a12434887
Sent from the R help mailing list archive at Nabble.com.

__
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] customizing the color and point shape for each line drawn using lattice's xyplot

2007-08-30 Thread Gen

Thank you for your suggestion. Unfortunately it does not appear to matter if
the data is subsetted before the xyplot command or within it.  The problem
remains. 

I was able to remove method 4 entirely from the key by using your suggestion
to subset the dataset “common,” and then creating a new variable to assign
labels for just this subset “common.without.Method4$method.not4.f”  The
resulting code was:

xyplot(MeanBxg ~ PercentVarExplained | bdg.f * bdx.f,
data=common.without.Method4, groups=method.not4.f, type=l,  auto.key=T)

This however leads to lack of continuity between plots, as when I exclude
methods 4 and 6 in my second plot, using the same approach, the color that
had corresponds to methods 7, 8 and 9 in plot one is automatically changed
in plot two.  The subsetting may work, so long as I can dictate line color
and symbol type in each plot. 



Ross Darnell wrote:
 
 Does this help
 
 common.without.Method4 - subset(common, Method!=4)
 xyplot(MeanBxg ~ PercentVarExplained | bdg.f * bdx.f,
 data=common.without.Method4,
 groups=Method.f, type=l,  auto.key=T)
 
 Ross Darnell
 
 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Gen
 Sent: Thursday, 30 August 2007 2:51 PM
 To: r-help@stat.math.ethz.ch
 Subject: [R] customizing the color and point shape for each line drawn
 using lattice's xyplot
 
 
 Description of what I am trying to do:
 I am using the xyplot code below to plot the variable MeanBxg against
 the
 variable PercentVarExplained for all 9 possible combinations of
 variables
 bdg and bdx.  Within each of these 9 scenarios I am plotting a
 separate
 line for each of up to 9 different methods that I used to estimate the
 variable MeanBxg. These methods are identified by the numeric variable
 called Method.  Giving me one plot with 9 figures and each of the
 figures
 contains 9 lines. 
 
 My problem arises because I would like to repeat the creation of this
 plot 8
 times, in each instance only a subset (eg 6) of the 9 methods are used
 (a
 different subset each time). 
 
 What I can't figure out:
 I would like to learn how to specify the exact line color that
 corresponds
 to each method such that Method==1 will always be represented by the
 same
 color (in every plot that it appears in).  Where two methods that I used
 were of the same family of methods (say method==1 and method==2 made the
 same assumptions about the data)  I would like to, if possible,
 represent
 the two methods using the same color and distinguish them by the symbol
 used
 to represent points on the line. 
 
 My code as it currently stands:
 xyplot(MeanBxg ~ PercentVarExplained | bdg.f * bdx.f, data=common,
 groups=common$Method.f, type=l, subset= Method!=4, auto.key=T)
 
 As the code is, the default colors assigned are repeated causing
 different
 methods to be represented by the same color with no way to distinguish
 them
 (I have not succeeded in plotting lines and points simultaneously).  
 
 Side question: When I subset the data to particular methods, is there a
 way
 to remove the excluded methods from the key as well? (in my code
 Method is
 a numeric variable, and Method.f corresponds to the lengthy
 descriptions
 of each method for the purpose of the key)
 
 Thank you very much for your help. 
 Genevieve
 
 
 
 -- 
 View this message in context:
 http://www.nabble.com/customizing-the-color-and-point-shape-for-each-lin
 e-drawn-using-lattice%27s-xyplot-tf4351934.html#a12400517
 Sent from the R help mailing list archive at Nabble.com.
 
 __
 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.
 
 

-- 
View this message in context: 
http://www.nabble.com/customizing-the-color-and-point-shape-for-each-line-drawn-using-lattice%27s-xyplot-tf4351934.html#a12409939
Sent from the R help mailing list archive at Nabble.com.

__
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] customizing the color and point shape for each line drawn using lattice's xyplot

2007-08-29 Thread Gen

Description of what I am trying to do:
I am using the xyplot code below to plot the variable “MeanBxg” against the
variable “PercentVarExplained” for all 9 possible combinations of variables
“bdg” and “bdx”.  Within each of these 9 scenarios I am plotting a separate
line for each of up to 9 different methods that I used to estimate the
variable MeanBxg. These methods are identified by the numeric variable
called “Method.”  Giving me one plot with 9 figures and each of the figures
contains 9 lines. 

My problem arises because I would like to repeat the creation of this plot 8
times, in each instance only a subset (eg 6) of the 9 methods are used (a
different subset each time). 

What I can’t figure out:
I would like to learn how to specify the exact line color that corresponds
to each method such that Method==1 will always be represented by the same
color (in every plot that it appears in).  Where two methods that I used
were of the same family of methods (say method==1 and method==2 made the
same assumptions about the data)  I would like to, if possible, represent
the two methods using the same color and distinguish them by the symbol used
to represent points on the line. 

My code as it currently stands:
xyplot(MeanBxg ~ PercentVarExplained | bdg.f * bdx.f, data=common,
groups=common$Method.f, type=l, subset= Method!=4, auto.key=T)

As the code is, the default colors assigned are repeated causing different
methods to be represented by the same color with no way to distinguish them
(I have not succeeded in plotting lines and points simultaneously).  

Side question: When I subset the data to particular methods, is there a way
to remove the excluded methods from the key as well? (in my code “Method” is
a numeric variable, and “Method.f” corresponds to the lengthy descriptions
of each method for the purpose of the key)

Thank you very much for your help. 
Genevieve



-- 
View this message in context: 
http://www.nabble.com/customizing-the-color-and-point-shape-for-each-line-drawn-using-lattice%27s-xyplot-tf4351934.html#a12400517
Sent from the R help mailing list archive at Nabble.com.

__
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] Horvitz Thompson Variance

2007-03-02 Thread Gen

I am performing linear regression R and would like to incorporate sampling
weights.  
Does any one know how to obtain Horvitz-Thompson variance estimates when
performing linear regression?
Thank you for your help.
-- 
View this message in context: 
http://www.nabble.com/Horvitz-Thompson-Variance-tf3336348.html#a9278653
Sent from the R help mailing list archive at Nabble.com.

__
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.