[R] xyplot w/ panel.lmline solution

2005-03-17 Thread eesteves
Dear Sebastian Luque (and All R Users)

With the following code I managed to plot different characters and regression
lines for panels 2 (Day of year 101) and 4 (Days of year 151, 157 and
172):

xyplot(log(no.larvae)~age.cls|factor(day),data=mortal,
layout=c(7,1),aspect=5/3,
xlab=Age class (d),ylab=Ln(Abundance),
 ylim=c(-2.5,6.5),xlim=c(0,30),
panel = function(x, y,panel.number) {
if(panel.number==2){
panel.xyplot(x, y,col=1)
panel.xyplot(x[6:11],y[6:11],pch=16,col=1)
panel.lmline(x[6:11],y[6:11])}
else{
panel.xyplot(x, y,col=1)
panel.xyplot(x[2:11],y[2:11],pch=16,col=1)
panel.lmline(x[2:11],y[2:11])}
if(panel.number4){
panel.xyplot(x, y,col=1)
panel.xyplot(x[14:20],y[14:20],pch=16,col=2)
panel.lmline(x[14:20],y[14:20],lty=2)}
})

The resulting plot is herein (attached MortalityRates.pdf file).

Thanks to you all, Eduardo Esteves

MortalityRates.pdf
Description: Adobe PDF document
__
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

[R] help w/ xyplot and panel.lmline

2005-03-15 Thread eesteves
Dear All,
I'm confortable with xyplot(...) and panel.lmline(...) statements (at least I
thought I did :). I've used the following code to plot the decline in
log-abundance of fish larvae (no.larvae) with age (age.cls, 4 to 27 days-old)
for specific dates of sampling (day, 9 dates). I further plotted data with
different colors and regression lines for ages 5-14 d and 17-23 d in a 7-by-1
layout.

 xyplot(log(no.larvae)~age.cls|factor(day),data=mortal,
  layout=c(7,1),aspect=5/3,
  xlab=Age class (d),ylab=Ln(Abundance),ylim=c(-2.5,6.5),xlim=c(0,30),
  panel = function(x, y) {
  panel.xyplot(x, y, col=1)
  panel.xyplot(x[5:14],y[5:14],pch=16,col=1)
  panel.lmline(x[5:14],y[5:14])
  panel.xyplot(x[17:23],y[17:23],pch=16,col=2)
  panel.lmline(x[17:23],y[17:23],lty=2)
  })

Is it possible to change the plotted characters and regression lines for two of
the panels (corresponding to dates 101 and 172). For these dates I intend to
use data only for ages 9-14 d instead of 5-14 d as for the remaining.

Thanks in advance,
Eduardo Esteves

__
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


[R] Help with multicomarisons after ANCOVA

2005-02-07 Thread eesteves
Dear All,

I' ve used ANCOVA (through lm(Y~factor*x)) to study the influence/differences
between levels of factor upon the Y-x relationship. I found that both
intercepts and slopes differ among levels of the factor. I understand from the
results of summary(lm(Y~factor*x)) which of the intercepts/slopes per level
differ from the reference level. I later used lm(Y~factor/(1+x)-1) to obtain
explicit coefficients per level.

My question is: Can I test for differences among all intercepts and /or slopes
per levels using simtest (from package multicomp) as summary
(simtest(Y~factor+x,type=tukey))?

The outputs seem to contradict the results from the explicit coefficients
approach!

Thanks in advance,
Eduardo

__
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


[R] help with vector operation

2005-01-31 Thread eesteves
Dear All,

I'm trying to calculate the following:

g.rate-(SL-int)/NO

where SL and NO are individual length and counts for the same subject, and the
int value is a day-specific value i.e. for each DAY=88, 101..., 172 I'd like to
use a different values of int=9.32, 8.43, ..., 9.81. All variables are compiled
in a larger data.frame of the form:

CODE  SLNO  DAY (...)
123   12.5  14  88
124   11.4  13  88
125   10.8  11  101
(...)
234   16.9  19  172 (...)

I've been trying apply() but with little (NONE) success!
Thanks, Eduardo Esteves

__
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


[R] Help w/ matrix calc

2004-07-29 Thread eesteves
Dear All,
Help is needed! I have a matrix with frequencies of fish larvae per length 
class (var. sl) and age-group (var. median.no) obtained with 

k-table(cut(sl,(5:22)),median.no)
k[2:5,1:5] #to ilustrate k

4  5  6  7 
(6,7]   3  1  0  0
(7,8]   3  0  1  0
(8,9]   3  4  3  5
(9,10]  3 15  7 13

from this matrix I would like to obtain the mean age per length class i.e. 
vector of line means. How can I do this? If, instead of the means I wanted the 
variances, how could I do it?
Thanks in advance,
Eduardo Esteves

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] lme question

2004-03-26 Thread eesteves

Dear All,
I need help both with analytical and computational aspects.

My problem: I have counted and measured increments on otoliths (inner-ear bony 
structures) of fish larvae collected at different times of day. This was 
repeated three times for each fish larvae (in random order and no particular 
dates). Then, I calculated the ratio of marginal-to-previous increment for each 
fish and reading. I wish to study if differences exist in ratios between hours 
of day (accounting for differences in readings within each fish) - in 
data.frame format... 

code   hour   read.no   ratio
33001  5  1 0.56
33003  7  1 0.93
37123  19 1 0.23
...
33001  5  2 0.62
33003  7  2 0.87
37123  19 2 0.22
...
37123  19 3 0.26
...

My solution: Use function lme, with hr-factor(hour)...

 hr.lme-lme(sqrt(ratio)~hr,random=~1|code/read.no)
 anova(hr.lme) ; summary (hr.lme)

Does this commands correspond to the initial problem statement? 

Thanks in advance.
Regards, Eduardo Esteves

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] model II regression

2004-01-15 Thread eesteves

Dear All, 

A friend asked me for help with a regression problem dealing with y and x, both 
random variables. 

The x and y are respectively the observed and estimated biomass values of a 
green algae derived from an ecological model. 

We first considered it to be a model II regression and derived the intercept 
and slope using Bartlett's method, reduced major axis (geometric mean 
regression) and major axis method (as implemented by Legendre). Then the 
significance and percentage of variance explained by the models was calculated 
(by hand) through ANOVA or Permutation test/Correlation (for later mehod). 

Our questions are: using a special approach to regression (model II) and then 
an ANOVA makes sense? I favour Legendre's approach but cannot justiy why! Is 
there any code/package available dealing with this problem?

Thanks, Eduardo

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] factorial experiments and repeated measures

2003-12-10 Thread eesteves
Dear All,
I'm new to the list and relatively new to R (but not so to S-Plus) and I´ve 
been asked to help study some experimental data.

In a factorial experiment (5 factors at 2 levels) the response-variable was 
measured at various times (0, 2, 5, 7, ..., 30 days after start). There's just 
one run for each factor combination! I intend to use the nlme library of 
Pinheiro and Bates in a longitudinal data situation but I have some 
difficulties with the statistical scenario of it all! 

The factors are not nested and the number of repeated measures is unbalanced 
(in some cases they were abandoned for some reason before the end of the 
experiment). The main objectives are to identify the factor(s) that influence 
the response and to model it.

How should I dissecate this? If in need of more info, just ask!

Thanks. Best regards, Eduardo Esteves

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help