Re: [R] Formatting Sweave in R-News

2007-08-22 Thread Gregor Gorjanc
Arjun Ravi Narayan contact at arjunnarayan.com writes:
 I am editing a document for submission to the R-news newsletter, and
 in my article my Sweave code inserts a dynamically generated PDF
 report that my R program generates.
 

Slightly off Arjuns topic is a problem with Schunk, Sinput and Soutput 
environments. They just use to much inline space. I have tweade this
problem with sed (see bellow for Makefile content), but wonder if there 
is a better solution.

Thanks, Gregor

default: Sweave fixTex
texi2pdf --clean wrapper.tex  evince wrapper.pdf

Sweave: # Sweave myPaper.Rnw
R CMD Sweave myPaper.Rnw

fixTex: Sweave # Change all S* environments to smallverbatim
@cat myPaper.tex | sed -e '/\\begin{Sinput}/d' \
   -e '/\\end{Sinput}/d' \
   -e '/\\begin{Soutput}/d' \
   -e '/\\end{Soutput}/d' \
   -e 's/\\begin{Schunk}/\\begin{smallverbatim}/g' \
   -e 's/\\end{Schunk}/\\end{smallverbatim}/g' \
 myPaper2.tex
@mv -f myPaper2.tex myPaper.tex

__
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] Formatting Sweave in R-News

2007-08-22 Thread Gregor Gorjanc
Hi Duncan,

Duncan Murdoch wrote:
 Slightly off Arjuns topic is a problem with Schunk, Sinput and Soutput
 environments. They just use to much inline space. I have tweade this
 problem with sed (see bellow for Makefile content), but wonder if there
 is a better solution.
 
 You can change the spacing by redefining those environments.  I use this:
 
 % This removes the extra spacing after code and output chunks in Sweave,
 % but keeps the spacing around the whole block.
 
 \fvset{listparameters={\setlength{\topsep}{0pt}}}
 \renewenvironment{Schunk}{\vspace{\topsep}}{\vspace{\topsep}}

Nice trick. Thank you.

I am CCing to a friend that had the same issue.

-- 
Lep pozdrav / With regards,
 Gregor Gorjanc
--
University of Ljubljana PhD student
Biotechnical Facultywww: http://www.bfro.uni-lj.si/MR/ggorjan
Zootechnical Department blog: http://ggorjan.blogspot.com
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si
SI-1230 Domzale fax: +386 (0)1 72 17 888
Slovenia, Europetel: +386 (0)1 72 17 861

__
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] rv package, rvnorm function

2007-08-21 Thread Gregor Gorjanc
John P. Burkett burkett at uri.edu writes:
 In an attempt to learn to use the rv package, I have been working
 through the examples in Jouni Kerman and Andrew Gelman's Using Random
 Variables to Manipulate and Summarize Simulations in R (July 4, 2007).

Perhaps Jouni can help you?

__
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] residual plots for lmer in lme4 package

2007-08-18 Thread Gregor Gorjanc
John Maindonald john.maindonald at anu.edu.au writes:
...
 The issue of checking for normality of effects in multi-level
 models has not been very much researched, as far as I can
 tell.  The function residuals()  gives residuals that adjust for
 all except the highest level of random effects.  Depending
 on the relative magnitudes of the variance components,
 whether or not these residuals are anywhere near normal
 may not be of much or any consequence.ž

For what it is worth I have came across this paper just recently:

http://www3.interscience.wiley.com/cgi-bin/abstract/114280441

Gregor

__
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] R2WinBUGS results not different with different runs

2007-08-08 Thread Gregor Gorjanc
 toby909 at gmail.com writes:
 
 Gregor Gorjanc wrote:
   toby909 at gmail.com writes:
  
 Is this a specialty with R2WinBUGS? Does it have something to do with the 
 seed value? Isnt the seed value reset everytime I restart winbugs?
  
  I always have the same seed if I start WinBUGS multiple times.
 
 So you get exactly the same chain, numerically, when rerunning the same 
  model, with the same number of iterations, everything the same.?

I just tried now with Gelman's schools example from bugs() help page. I runned
the same job twice, with exactly the same initial values. Notes that WinBUGS
uses always the same starting seed. I got this

 schools.sim$last.values
[[1]]
[[1]]$theta
[1] 23.700 10.060 12.760 13.090  1.693 14.390  7.599  3.961

[[1]]$mu.theta
[1] 25.03

[[1]]$sigma.theta
[1] 20.08



 schools.sim2$last.values
[[1]]
[[1]]$theta
[1] 23.700 10.060 12.760 13.090  1.693 14.390  7.599  3.961

[[1]]$mu.theta
[1] 25.03

[[1]]$sigma.theta
[1] 20.08

 Wouldnt that be problematic if every researcher in the world who uses winbugs 
 uses the same sequence of random numbers?
 
 R's random numbers are different each time, because the seed is linked to the 
 clock in your PC.

You can reset the seed if you want. Having the same seed is also nice for 
repeatability.

Gregor

__
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] R2WinBUGS results not different with different runs

2007-08-07 Thread Gregor Gorjanc
 toby909 at gmail.com writes:
 Is this a specialty with R2WinBUGS? Does it have something to do with the 
 seed 
 value? Isnt the seed value reset everytime I restart winbugs?

I always have the same seed if I start WinBUGS multiple times.

Gregor

__
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] error in using R2WinBUGS on Ubuntu 6.10 Linux

2007-07-31 Thread Gregor Gorjanc
J. Patrick Meyer meyerjp at jmu.edu writes:
 
 I'm using Wine 0.9.41, and the patched version of WinBUGS. Everything 
 seems to run correctly. I get the right output from WinBUGS. I'm not 
 sure to what the error message refers.

I also get this messages, but that is comming from wine and can be safely 
ignored.

Gregor

__
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] icc from GLMM?

2007-06-11 Thread Gregor Gorjanc
Shinichi Nakagawa S.Nakagawa at sheffield.ac.uk writes:
... 
 I am a little confused which one to trust and use. Or there are no easy form
 to do this? I am guessing formula would change depending on what distribution
 you use and what link function as well? I want to calculate icc from GLMM with
 Poisson with log link function and also binomial with logit function. Could
 anybody help me please?

Yes, you are right that ICC depends on assumed data distribution. While ICC is
very handy in linear models it is not the case in GLMM. I suggest you take a
look at the references bellow. There is also some online material by the same
authors. Additionally, I remember that there were lively discussions about ICC
on multilevel list at

http://www.jiscmail.ac.uk/lists/multilevel.html

Best wishes, Gregor

@Article{Goldstein:2002,
  author =   {Goldstein, H. and Browne, W. and Rabash, J.},
  title ={Partitioning variation in multilevel models},
  journal =  {Understanding Statistics},
  year = {2002},
  volume =   {1},
  number =   {4},
  pages ={223--231},
  keywords = {variance ratio, variance partition coefficient,
  intra-unit correlation, intra-class correlation, normal
  models, discrete models, random coefficient models}
}

@Article{Browne:2005,
  author =   {Browne, W. J. and Subramanian, S. V. and Jones, K. and
  Goldstein, H.},
  title ={Variance partitioning in multilevel logistic models that
  exhibit overdispersion},
  journal =  {J. R. Stat. Soc. A Stat. Soc.},
  year = {2005},
  volume =   {168},
  number =   {3},
  pages ={599--613},
  doi =  {10./j.1467-985X.2004.00365.x},
  checked =  {[2006-04-16]},
  keywords = {heritability, ratios, intra-class correlation,
  intra-unit correlation, simulation, linearization, latent
  variable approach},
}

__
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] Refactor all factors in a data frame

2007-06-06 Thread Gregor Gorjanc
Hilmar Berger hilmar.berger at imise.uni-leipzig.de writes:
...
 So, is there any way in drop the unused factor levels from *all* factors 
 of a data frame without import/export ?

There is a generic drop.levels in gdata. Here is part of its help page:

\code{drop.levels} is a generic function, where default method does
nothing, while method for factor \code{s} drops all unused levels.
There are also convenient methods for \code{list} and \code{data.frame},
where all unused levels are dropped in all factors (one by one) in a
\code{list} or a \code{data.frame}.

Gregor

__
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] .C HoltWinters

2007-02-28 Thread Gregor Gorjanc
sj ssj1364 at gmail.com writes:

 Hello,
 
 I would like to look at the compiled C code behind HoltWinters from the
 stats package. Is that possible? If so where do I find it?

Get the R source tarball from CRAN unpack it and search for the C code.

Gregor

__
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] write fixed format

2007-02-22 Thread Gregor Gorjanc
YIHSU CHEN yihsu.chen at ucmerced.edu writes:
 Dear R users;
 
 Is there a function in R that I can put text with proper alignments in 
 a fixed format.  For instance, if I have three fields: A, B and C, where 
 both A and C are text with 3 characters and left alignment; B is a 
 numeric one with 2 decimals and 3 integer space digits.   How can I put 
 the following row in a file? (note there is a space between a and 2, and 
 after b.) (A=aaa, B=23.11 and C=bb)
 aaa 23.11bb 

Check write.fwf() in gdata package. It might help you, but you will have to 
create new column to have B and C together i.e. without any space between.

Gregor

__
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] setting a number of values to NA over a data.frame.

2007-02-12 Thread Gregor Gorjanc
Jim Lemon jim at bitwrit.com.au writes:
 Hi John,
 You might have a look at toNA in the prettyR package. Wait for version 
 1.0-4, just uploaded, as I have fixed a bug in that function.

There is also a set of generic functions exactly for such cases: unknownToNA(),
NAToUnknown() and isUnknown() in gdata package.

Gregor

__
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] SQL statements (directly) in R

2007-02-12 Thread Gregor Gorjanc
Wensui Liu liuwensui at gmail.com writes:

 
 chris,
 if you could create a package similar to proc sql in SAs, that will be 
 so sweet.

Nice task, but I would not suggest to go this way. I found it quite easy to 
work with R subsetting system after you get some practice and that is more
than enough - at least for me. Maybe you should look into sqllite stuff that
BioC guys are working on.

Gregor

__
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] lmer and estimation of p-values: error with mcmcpvalue()

2007-02-12 Thread Gregor Gorjanc
Christoph Scherber Christoph.Scherber at agr.uni-goettingen.de writes:
 
 Dear Henric,
 
 Thanks, now it works; but how reliable are these estimates? Especially 
 with p-values close to 0.05 it is of course important that the range of 
 the estimates is not too large. I´ve just run several simulations, each 
 of which yielding sometimes quite different p-values.

I have not been using mcmcsamp(), but try increasing number of simulations.
Additionally, since you have only single parameters, you can directly look
at their posterior distributions and compute the areas under the curve.

Gregor

__
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] generate Binomial (not Binary) data

2007-02-09 Thread Gregor Gorjanc
Marc Bernard bernarduse1 at yahoo.fr writes:
   I am looking for an R function or any other reference to generate a series
of correlated Binomial (not a
 Bernoulli) data. The bindata library can do this for the binary not the
binomial case.

But binomial is just a sum of Bernoulli vars so this should be doable. 

Gregor

__
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] ECB/Sidebar/R (Emacs) was: Re: kate editor for R

2007-01-23 Thread Gregor Gorjanc
Ramon Diaz-Uriarte rdiaz02 at gmail.com writes:
  I had looked at ECB for C++ programming. It simply hadn't occurred to me 
  that
  it would plug into ESS.
 
 I wasn't aware of it either until I attended Tony Rossini's tutorial
 at useR! 2006.
 

Are there any materials for those who missed the course?

Gregor

__
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] zero random effect sizes with binomial lmer

2007-01-01 Thread Gregor Gorjanc
Daniel Ezra Johnson johnson4 at babel.ling.upenn.edu writes:
 1) Yes, I have tweaked the data to show as clearly as I can that this is a 
 bug, that a tiny change in initial conditions causes the collapse of a 
 reasonable 'parameter' estimate.

I would not call this a bug, since this is related to data and not to the
software. I might be wrong!

 2) mcmcsamp() does not work (currently) for binomial fitted models.

Sorry, for wrong pointer. You could try with some other packages if they
have support for binomial models with random effects. I would just try
in BUGS -- take a look at R2WinBUGS or Brugs.

 3) This is an issue of what happens when the sample is too small. For all 
 larger data sets I have gotten a ranef variance between 0.05 and 1.00 or 
 so.
 
 It makes no sense to say that as the data set gets smaller, the systematic 
 variation between Items goes away. It doesn't, as I've shown. In the data 

I believe that when data gets smaller such parameters are harder to estimate
and you can easily get 0 as MLE.

 above, certain Items were still 10+ times as likely (log-odds wise) to 
 have Response==1 as others.

Gregor

__
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] zero random effect sizes with binomial lmer

2006-12-31 Thread Gregor Gorjanc
Daniel Ezra Johnson johnson4 at babel.ling.upenn.edu writes:
...
 If one compares the random effect estimates, in fact, one sees that  
 they are in the correct proportion, with the expected signs. They are  
 just approximately eight orders of magnitude too small. Is this a bug?
...

BLUPs are essentially shrinkage estimates, where shrinkage is determined with
magnitude of variance. Lower variance more shrinkage towards the mean - zero 
in this case. So this is not a bug.

Gregor

__
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] zero random effect sizes with binomial lmer

2006-12-31 Thread Gregor Gorjanc
Daniel Ezra Johnson johnson4 at babel.ling.upenn.edu writes:
...
 More broadly, is it hopeless to analyze this data in this manner, or  
 else, what should I try doing differently? It would be very useful to  
 be able to have reliable estimates of random effect sizes, even when  
 they are rather small.
...

You might try with mcmcsamp to get a better view of posterior distributions of
your parameters. It might be the case that MLE for item variance is near 0, 
while
its posterior distribution covers also values that are higher than 0.

Gregor

__
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] zero random effect sizes with binomial lmer

2006-12-31 Thread Gregor Gorjanc
Daniel Ezra Johnson johnson4 at babel.ling.upenn.edu writes:
   If one compares the random effect estimates, in fact, one sees that
   they are in the correct proportion, with the expected signs. They are
   just approximately eight orders of magnitude too small. Is this a bug?
  
  BLUPs are essentially shrinkage estimates, where shrinkage is
  determined with magnitude of variance. Lower variance more
  shrinkage towards the mean - zero in this case. So this is not a bug.
  
  Gregor
 
 I doubled each data set by duplicating each Subject. There are now
 46 subjects in each group instead of 23. So now A and B differ in 2
 observations out of 322. The lmer resuls are sensible.

Why would you want to do that? Doubling your data set is not what you
want as you are hacking the analysis. You should definitely avoid this for
real analysis!

 I know BLUPs are not like regular parameters, but doubling (or cutting
 in half) the data should not, in my opinion, cause this behavior. There
 is a lot of room for the original A variance estimate to be lower than B,
 maybe it should be 0.05, 0.01, 0.05, or whatever, but not  .05.

This is numerical procedure and if log-likelihood is flat then it might happen
that algorithms give you such estimates. When you doubled the data
log-likelihood gets more peaked shape and then it seems reasonable that
estimates are more consistent.

 I understand that the between-Item variance is low, and probably
 it is no greater than what you would expect to occur by chance,
 but isn't that what hypothesis testing is for (anova, etc.)?

Yes, but anova etc. is not a super tool. If you get parameter estimates that
are essentially 0, do you still need hypothesis testing?

 Is my best way around the algorithm returning zero to do
 what I have done above, with my real data? That is, duplicate
 (or triplicate) Subjects to increase my data size, and thereby
 get a reasonably comparable (if wrong) estimate of the Item variance?
 Zero is not a reasonable estimate in any of these data sets.

No!

Try with mcmcsamp and then you might get better view of posterior distribution
of item variance. I think that MLE is near zero with some support for positive 
values. Try to play with lmer i.e. with starting values etc. 

Additionally, why do you want to estimate variances separately for dataset A and
B. Can you really suggest that they should be different between datasets?

Gregor

__
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] Genotypes are not all the same

2006-12-28 Thread Gregor Gorjanc
Farrel Buchinsky fjbuch at gmail.com writes:
 Clearly g1 and g2 are not exactly the same even though they are the same
 class.
 I can make g2 behave as g1 if i type
 g3-genotype(g2)
 g3 then behaves as it should.
 
 The issue may have arrisen since g2 is just a subset of a much bigger object
 that was created using reshape command in the base package or maybe melt and
 cast in the reshape package. Can anyone enlighten me?

genotype class behaves internally much like factor class. I guess that
levels/alleles were dropped somewhere. You have to figure out where this 
happened.

Gregor

__
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] [Fwd: [AGDG-LIST:428] Summer Course in Guelph]

2006-12-23 Thread Gregor Gorjanc


 Original Message 
Subject: [AGDG-LIST:428] Summer Course in Guelph
Date: Fri, 22 Dec 2006 09:12:24 -0500
From: Larry Schaeffer [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Animal Geneticist's Discussion [EMAIL PROTECTED]

The Centre for Genetic Improvement of Livestock at the University of
Guelph is pleased
to announce a one week summer course entitled Animal Breeding
Applications Using R to be
given by Bill Szkotnicki and Larry Schaeffer from June 11 to June 15,
2007.  Details will be
available in the new year on the CGIL website:
http://cgil.uoguelph.ca/

The content of the course will be:

Introduction to R
Getting data in and out
Introductory statistical models
Packages and graphics functions
Distributions and simulations
Developing your own functions
Accessing the operating system
The R API
Database connectivity
Programming in R using Fortran and C subroutines
Animal breeding applications
- Inbreeding routines
- Animal models
- Iteration on data
- Maternal genetic effects
- Multiple traits
- Random regression
- Threshold models
- Genomic applications

On the application form you will be able to indicate particular problems
that
you would like to see covered, and we will try to work them into the
course.


-- 
Lep pozdrav / With regards,
Gregor Gorjanc
--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] change factor level 1,2,3 to red,blue,dark

2006-12-07 Thread Gregor Gorjanc
Aimin Yan aiminy at iastate.edu writes:
 I am new to R. Maybe this is very simple question.
 I have a dataframe, there is column that is factor.
 This factor has three level that 1,2,3.
 Now I want to change these  level(1,2,3) to level(red,blue,dark).
 Does anybody how to do this job?

levels() help page has entry about this. Try

x - factor(round(runif(n=10, min=1, max=3)))
x
 [1] 3 1 1 3 1 2 2 2 1 2
Levels: 1 2 3

levels(x) - list(red=c(1), blue=c(2), dark=c(3))
x
 [1] dark red  red  dark red  blue blue blue red  blue
Levels: red blue dark

You have factor in data.frame, so you have to use

levels(myDF$x) - ...


Gregor

__
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] lmer and a response that is a proportion

2006-12-03 Thread Gregor Gorjanc
Cameron Gillies cgillies at ualberta.ca writes:
 Hello Simon and John,
 
 I'm afraid I need to include random effects, both a random intercept and
 possibly random coefficients and it doesn't look like betareg can do that.

Kevin Wright has posted wish on R-wiki for beta mixed effects model. There is no
package for this, but there was a nice article describing such a model. Well, it
is a start.

Gregor

__
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] showing available environment variables

2006-11-29 Thread Gregor Gorjanc
Karin Lagesen karin.lagesen at medisin.uio.no writes:
...
 The default program for reading files when using openVignettes on my
 system is ggv. ggv is broken. I would therefore like to use a
 different program, and I found the variable R_PDFVIEWER which should
 do the trick. However, so far no luck.
 
 Therefore, how do I ask R what variables are available, and how do I
 get it to show what it is currently set to.

Try options(pdfviewer=something)

Gregor

__
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] Fitting mixed-effects models with lme with fixed error term variances

2006-11-26 Thread Gregor Gorjanc
Hello!

Douglas Bates wrote:
...
  Not quite.  There is now a capability in lmer to specify starting
  estimates for the relative precision matrices which means that you can
  use the estimates from one fit as starting estimates for another fit.
  It looks like
 
  fm1 - lmer(...)
  fm2 - lmer(y ~ x + (...), start = [EMAIL PROTECTED])
 
  I should say that in my experience this has not been as effective as I
  had hoped it would be.  What I see in the optimization is that the
  first few iterations reduce the deviance quite quickly but the
  majority of the time is spent refining the estimates near the optimum.
  So, for example, if it took 40 iterations to converge from the rather
  crude starting estimates calculated within lmer it might instead take
  35 iterations if you give it good starting estimates.

 Yes, I also have the same experience with other programs, say VCE[1].
 What I was hopping for was just solutions from linear mixed model i.e.
 either via GLS or PLS representations and no optimization if values for
 variance components are passed as input - there should be a way to
 distinguish that from just passing starting values..
 
 The PLS representation in lmer is in terms of the relative
 variance-covariance matrices of the random effects where relative
 means relative to s^2.  (In fact, the Omega slot contains the relative

What exactly is s^2?

 precision matrices (inverses of the relative variance matrices) but
 its the same idea.  All variance components are expressed relative to
 s^2.)  If it is sufficient to fix these then you can easily do that.
 Just follow the code in lmer until it gets to
 
   .Call(mer_ECMEsteps, mer, cv$niterEM, cv$EMverbose)
   LMEoptimize(mer) - cv
   return(new(lmer, mer,
 
 and replace the first two lines by
 
   .Call(mer_factor, mer, PACKAGE = lme4)

Hmm. Sounds simple. I will try this. Do you find any value in adding
this as an option in lmer or perhaps new? function, say lmeSol() or
something similar?

 A side-effect of performing the factorization is to evaluate the ML
 and REML deviances and store the result in the deviance slot.
 
 The follow the code in lmer part will get a bit tricky because of
 the number of functions that are hidden in the lme4 namespace but I'm
 sure you know how to get around that.

Thank you very much!

Gregor

__
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] low-variance warning in lmer

2006-11-24 Thread Gregor Gorjanc
Ben Bolker bolker at zoo.ufl.edu writes:
   For block effects with small variance, lmer will sometimes
...
   My question is: what should I suggest to students when this
 situation comes up?  Can anyone point me to appropriate references?
 (I haven't found anything relevant in Pinheiro and Bates, but
 I may not have looked in the right place ...)

Gelman has quite some similar examples. Take a look at his schools example in
the Bayesian book.

Gregor

__
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] Fitting mixed-effects models with lme with fixed error term variances

2006-11-22 Thread Gregor Gorjanc
Douglas Bates wrote:
 On 11/21/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 Douglas Bates bates at stat.wisc.edu writes:
 ...
  Can you be more specific about which parameters you want to fix and
  which you want to vary in the optimization?

 It would be nice to have the ability to fix all variances i.e.
 variances of
 random effects.
 
 That gets tricky in terms of the parameterization of the
 variance-covariance matrices for vector-valued random effects.  These
 matrices are not expressed in the conventional parameterization of
 variances and covariances or even variances and correlation because
 the conditions for the resulting matrix to be positive definite are
 not simple bounds or easily expressed transformations then the matrix
 is larger than 2 by 2.  I suppose what I could do is to allow these
 matrices to be specified in the parameterization that is used in the
 optimization and provide a utility function to map from the
 conventional parameters to these.  That would mean that you couldn't
 fix ,say, the variance of the intercept term for vector-valued random
 effects but allow the variance of a slope for the same grouping factor
 to be estimated.  Well, you could but only in the fortune(Yoda)
 sense.
 

Yes, I agree here. Thank you for the detailed answer.

 By the way, if you fix all the variances then what are you optimizing
 over?  The fixed effects?  In that case the solution can be calculated
 explicitly for a linear mixed model.  The conditional estimates of the
 fixed effects given the variance components are the solution to a
 penalized linear least squares problem.  (Yes, the solution can also
 be expressed as a generalized linear least squares problem but there
 are advantages to using the penalized least squares representation.

Yup. It would really be great to be able to do that nicely in R, say use
lmer() once and since this might take some time use estimates of
variance components next time to get fixed and random effects. Is this
possible with lmer or any related function - not in fortune(Yoda) sense ;)

-- 
Lep pozdrav / With regards,
Gregor Gorjanc
--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Fitting mixed-effects models with lme with fixed error term variances

2006-11-22 Thread Gregor Gorjanc
Hello!

Douglas Bates wrote:
 On 11/22/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 Douglas Bates wrote:
  On 11/21/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
  Douglas Bates bates at stat.wisc.edu writes:
  ...
   Can you be more specific about which parameters you want to fix and
   which you want to vary in the optimization?
 
  It would be nice to have the ability to fix all variances i.e.
  variances of
  random effects.
 
...
  effects but allow the variance of a slope for the same grouping factor
  to be estimated.  Well, you could but only in the fortune(Yoda)
  sense.
 

 Yes, I agree here. Thank you for the detailed answer.

  By the way, if you fix all the variances then what are you optimizing
  over?  The fixed effects?  In that case the solution can be calculated
  explicitly for a linear mixed model.  The conditional estimates of the
  fixed effects given the variance components are the solution to a
  penalized linear least squares problem.  (Yes, the solution can also
  be expressed as a generalized linear least squares problem but there
  are advantages to using the penalized least squares representation.

 Yup. It would really be great to be able to do that nicely in R, say use
 lmer() once and since this might take some time use estimates of
 variance components next time to get fixed and random effects. Is this
 possible with lmer or any related function - not in fortune(Yoda)
 sense ;)
 
 Not quite.  There is now a capability in lmer to specify starting
 estimates for the relative precision matrices which means that you can
 use the estimates from one fit as starting estimates for another fit.
 It looks like
 
 fm1 - lmer(...)
 fm2 - lmer(y ~ x + (...), start = [EMAIL PROTECTED])
 
 I should say that in my experience this has not been as effective as I
 had hoped it would be.  What I see in the optimization is that the
 first few iterations reduce the deviance quite quickly but the
 majority of the time is spent refining the estimates near the optimum.
 So, for example, if it took 40 iterations to converge from the rather
 crude starting estimates calculated within lmer it might instead take
 35 iterations if you give it good starting estimates.

Yes, I also have the same experience with other programs, say VCE[1].
What I was hopping for was just solutions from linear mixed model i.e.
either via GLS or PLS representations and no optimization if values for
variance components are passed as input - there should be a way to
distinguish that from just passing starting values..

[1]http://vce.tzv.fal.de/index.pl

Gregor

__
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] multiple R listservs?

2006-11-17 Thread Gregor Gorjanc
Jeff Miller jeffmiller at adsam.com writes:
 I thought more about this last night after my email about putting an end to
 Read the Manual replies.
...
 A potential solution is to offer two lists.one for newbies and one
 for.umm.not-newbies. Some not-newbies may prefer subscribing to both and
 setting up 2 email folders.

There is R-help and R-devel already. If you find to much traffic on the R-help
you could read only those mails that attract you - that is what I do.
Additionally, using Gmane with Bloglines is very very nice for my inbox.

Gregor

__
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] query in R

2006-11-08 Thread Gregor Gorjanc
Jin,

Xiaodong Jin close2ceo at yahoo.com writes:
 how to realize the following SQL command in R?
 
   select distinct A, B, count(C)
   from TABLE
   group by A, B
   ;
   quit;
 

if you want to perform such query on a data.frame! then

table(table$a, table$b)

will produce similar output, but in 2-way table, or this
for similar output

table(paste(table$a, -, table$b))

Gregor

__
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] Probit Scale

2006-11-07 Thread Gregor Gorjanc
nelson - nelson1977 at gmail.com writes:
 Hi all!
   i search but i found no info, so i'm heere to ask you! How can i
 plot a graph using the probit scale on y axes?

Not that I know, however you can transform y values via pnorm() i.e.

plot(x=x, y=pnorm(q=y, ...))

Gregor

__
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] Composition like classes functions

2006-11-06 Thread Gregor Gorjanc
Gregor Gorjanc gregor.gorjanc at bfro.uni-lj.si writes:
 Hello!
 
 I am working on breed composition of animals in my project. Say I have
 an animal 1 with parents 2 (father) and 3 (mother). If father is of
 breed A and mother of breed B, then their descendant is of breed AB or
 50 % of A and 50 % of B. I would like to have a general way to represent
  this kind of data. I was thinking about list structure i.e.
...
 
 However, I would like to ask if there is anything like this already in R
 or contributed packages.

Replying myself. There is a package compositions at CRAN. I should have done
homework before asking here.

Gregor

__
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] Placing of legends

2006-11-05 Thread Gregor Gorjanc
Thevini  Christian Lerch t.c.l at gmx.net writes:
 placings of legends is sometimes tricky.
 For placing outside the plot region I found locator to be useful. 
 Unfortunately, the click defines the upper left corner.
 
 Is there a way to change this corner (say lower right corner)?

Not sure about outside plot region but you can specify position very easy. Take
a look at legend help page - 3rd paragraph under details.

Gregor

__
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] Date, date, POSIX question

2006-11-05 Thread Gregor Gorjanc
Joe W. Byers Joe-Byers at utulsa.edu writes:
...
 Can anyone explain the benefits and detractions of the 'Date' package 
 verses the 'date' package and verses 'POSIX' dates.
 
...

Not sure which one should be prefered, but there was an article in Rnews that
nicely covered pros and cons.

Gregor

__
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] read.fwf and header

2006-11-01 Thread Gregor Gorjanc
Greg Snow wrote:
 How about using a connection and reading the header separate from the
 data, like this:
 
 tmp1 - file('c:/temp/tmp.dat')
 open(tmp1)
 
 my.names - scan(tmp1, nlines=1, what='')
 
 
 new.data-read.fwf(file=tmp1, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 19),
 header=FALSE)
 
 names(new.data) - my.names
 
 close(tmp1)

Yes, also possible as has been shown in previous posts.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc
--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] read.fwf and header

2006-10-31 Thread Gregor Gorjanc
Martin Maechler wrote:
 Gregor == Gregor Gorjanc [EMAIL PROTECTED]
 on Mon, 30 Oct 2006 23:33:21 +0100 writes:
 
 Gregor Daniel Nordlund wrote:
  Gregor,
  
  According to the help for read.fwf, sep needs to be set
  to a value that occurs only in the header record.  I
  changed the spaces to commas in the header record of your
  example and used the following syntax and was able to
  read the file just fine.
  
  new.data-read.fwf(file=test.txt, widths=c(3, 4, 10, 3,
  2, 2, 2, 2, 11, 19), header=TRUE, sep=',')
  
  Hope this is helpful,
  
  Dan
 
 Gregor Thanks Dan! But I have to modfy file first. Not that
 Gregor much of work but still.
 
 Yes, but I think it shows read.fwf() should not be extended for
 even more special cases:
 
 In my (and probably R-core's) view, read.fwf() should only have
 to be used for ``legacy data files'' (those times when people used *no*
 separators in order to save disk space), since nowadays, such
 data files should automatically have correct separators. 
 
 -- Fix the file producing process rather than make read.fwf()
 unnecessarily more complicated.

Thank you for this explanation of your (and probably R-core's) view! I
really appreciate such feedback. I do agree that read.fwf is a bit
archaic way to import data, but sometimes you can not fix file
producing process.

Perhaps above explanation and code examples from this thread could be
added to read.fwf help page. I can provide a patch if my proposal is sane.

Regards, Gregor

__
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] Composition like classes functions

2006-10-30 Thread Gregor Gorjanc
Hello!

I am working on breed composition of animals in my project. Say I have
an animal 1 with parents 2 (father) and 3 (mother). If father is of
breed A and mother of breed B, then their descendant is of breed AB or
50 % of A and 50 % of B. I would like to have a general way to represent
 this kind of data. I was thinking about list structure i.e.

list(A=0.5, B=0.5)
$A
[1] 0.5

$B
[1] 0.5

Additionally, it should accommodate for more than 2 classes.

However, I would like to ask if there is anything like this already in R
or contributed packages.

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc
--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] read.fwf and header

2006-10-30 Thread Gregor Gorjanc
Hi!

I have data (also in attached file) in the following form:

num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt
 11   f q   1900-01-01 1900-01-01 01:01:01
 2 1.0 131.5  2 a g r z1900-01-01 01:01:01
 3 1.5 1188830.5  3 b h s y 1900-01-01 1900-01-01 01:01:01
 4 2.0 1271846.3  4 c i t x 1900-01-01 1900-01-01 01:01:01
 5 2.5  829737.4d j u w 1900-01-01
 6 3.0 1240967.3  5 e k v v 1900-01-01 1900-01-01 01:01:01
 7 3.5  919684.4  6 f l w u 1900-01-01 1900-01-01 01:01:01
 8 4.0  968214.6  7 g m x t 1900-01-01 1900-01-01 01:01:01
 9 4.5 1232076.4  8 h n y s 1900-01-01 1900-01-01 01:01:01
10 5.0 1141273.4  9 i o z r 1900-01-01 1900-01-01 01:01:01
   5.5  988481.4 10 j q 1900-01-01 1900-01-01 01:01:01

This is a FWF (fixed width format) file. I can not use read.table here,
because of missing values. I have tried with the following

 read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20),
header=TRUE)

Error in read.table(file = FILE, header = header, sep = sep, as.is =
as.is,  :
more columns than column names

I could use:

 read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20),
header=FALSE, skip=1)
   V1  V2V3 V4 V5 V6 V7 V8  V9 V10
1   1  NANA  1f  q 1900-01-01  1900-01-01 01:01:01
2   2 1.0 131.5  2 a  g  r  z  1900-01-01 01:01:01
3   3 1.5 1188830.5  3 b  h  s  y  1900-01-01  1900-01-01 01:01:01
4   4 2.0 1271846.3  4 c  i  t  x  1900-01-01  1900-01-01 01:01:01
5   5 2.5  829737.4 NA d  j  u  w  1900-01-01
6   6 3.0 1240967.3  5 e  k  v  v  1900-01-01  1900-01-01 01:01:01
7   7 3.5  919684.4  6 f  l  w  u  1900-01-01  1900-01-01 01:01:01
8   8 4.0  968214.6  7 g  m  x  t  1900-01-01  1900-01-01 01:01:01
9   9 4.5 1232076.4  8 h  n  y  s  1900-01-01  1900-01-01 01:01:01
10 10 5.0 1141273.4  9 i  o  z  r  1900-01-01  1900-01-01 01:01:01
11 NA 5.5  988481.4 10 jq  1900-01-01  1900-01-01 01:01:01

Does anyone have a clue, how to get above result with header?

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc
--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] read.fwf and header

2006-10-30 Thread Gregor Gorjanc
Marc Schwartz wrote:
 On Mon, 2006-10-30 at 19:51 +0100, Gregor Gorjanc wrote:
 Hi!

 I have data (also in attached file) in the following form:

 num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt
  11   f q   1900-01-01 1900-01-01 01:01:01
  2 1.0 131.5  2 a g r z1900-01-01 01:01:01
  3 1.5 1188830.5  3 b h s y 1900-01-01 1900-01-01 01:01:01
  4 2.0 1271846.3  4 c i t x 1900-01-01 1900-01-01 01:01:01
  5 2.5  829737.4d j u w 1900-01-01
  6 3.0 1240967.3  5 e k v v 1900-01-01 1900-01-01 01:01:01
  7 3.5  919684.4  6 f l w u 1900-01-01 1900-01-01 01:01:01
  8 4.0  968214.6  7 g m x t 1900-01-01 1900-01-01 01:01:01
  9 4.5 1232076.4  8 h n y s 1900-01-01 1900-01-01 01:01:01
 10 5.0 1141273.4  9 i o z r 1900-01-01 1900-01-01 01:01:01
5.5  988481.4 10 j q 1900-01-01 1900-01-01 01:01:01

 This is a FWF (fixed width format) file. I can not use read.table here,
 because of missing values. I have tried with the following

 read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20),
 header=TRUE)

 Error in read.table(file = FILE, header = header, sep = sep, as.is =
 as.is,  :
  more columns than column names

 I could use:

 read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20),
 header=FALSE, skip=1)
V1  V2V3 V4 V5 V6 V7 V8  V9 V10
 1   1  NANA  1f  q 1900-01-01  1900-01-01 01:01:01
 2   2 1.0 131.5  2 a  g  r  z  1900-01-01 01:01:01
 3   3 1.5 1188830.5  3 b  h  s  y  1900-01-01  1900-01-01 01:01:01
 4   4 2.0 1271846.3  4 c  i  t  x  1900-01-01  1900-01-01 01:01:01
 5   5 2.5  829737.4 NA d  j  u  w  1900-01-01
 6   6 3.0 1240967.3  5 e  k  v  v  1900-01-01  1900-01-01 01:01:01
 7   7 3.5  919684.4  6 f  l  w  u  1900-01-01  1900-01-01 01:01:01
 8   8 4.0  968214.6  7 g  m  x  t  1900-01-01  1900-01-01 01:01:01
 9   9 4.5 1232076.4  8 h  n  y  s  1900-01-01  1900-01-01 01:01:01
 10 10 5.0 1141273.4  9 i  o  z  r  1900-01-01  1900-01-01 01:01:01
 11 NA 5.5  988481.4 10 jq  1900-01-01  1900-01-01 01:01:01

 Does anyone have a clue, how to get above result with header?

 Thanks!
 
 The attachment did not come through. Perhaps it was too large?
 
 Not sure if this is the most efficient way, but how about this:
 
 DF - read.fwf(test.txt, 
 widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20),
 skip = 1, strip.white = TRUE,
 col.names = read.table(test.txt, 
nrow = 1, as.is = TRUE)[1, ])
 

Argh, my fault as I forgot to attach it :(

 Not sure if this is the most efficient way, but how about this:

 DF - read.fwf(test.txt,
 widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20),
 skip = 1, strip.white = TRUE,
 col.names = read.table(test.txt,
nrow = 1, as.is = TRUE)[1, ])


That is a very nice compromise! No need for [1, ], due to nrow=1.

 Of course, with the limited number of columns, you can always just set

 colnames(DF) - c(num1, num2, num3, int1, fac1,
   fac2, cha1, cha2, Date, POSIXt)


I fully agree here, but I kind of lack this directly in read.fwf. I hope
that someone from R-core is also listening to this ;)

Thank you!

Gregor
num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt
 11   f q   1900-01-01 1900-01-01 01:01:01
 2 1.0 131.5  2 a g r z1900-01-01 01:01:01
 3 1.5 1188830.5  3 b h s y 1900-01-01 1900-01-01 01:01:01
 4 2.0 1271846.3  4 c i t x 1900-01-01 1900-01-01 01:01:01
 5 2.5  829737.4d j u w 1900-01-01
 6 3.0 1240967.3  5 e k v v 1900-01-01 1900-01-01 01:01:01
 7 3.5  919684.4  6 f l w u 1900-01-01 1900-01-01 01:01:01
 8 4.0  968214.6  7 g m x t 1900-01-01 1900-01-01 01:01:01
 9 4.5 1232076.4  8 h n y s 1900-01-01 1900-01-01 01:01:01
10 5.0 1141273.4  9 i o z r 1900-01-01 1900-01-01 01:01:01
   5.5  988481.4 10 j q 1900-01-01 1900-01-01 01:01:01
__
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] read.fwf and header

2006-10-30 Thread Gregor Gorjanc
Daniel Nordlund wrote:
 Gregor,
 
 According to the help for read.fwf, sep needs to be set to a value that 
 occurs only in the header record.  I changed the spaces to commas in the 
 header record of your example and used the following syntax and was able to 
 read the file just fine.
 
 new.data-read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 19),
   header=TRUE, sep=',')
 
 Hope this is helpful,
 
 Dan

Thanks Dan! But I have to modfy file first. Not that much of work but still.

Regards, Gregor

__
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] Header of dataframe

2006-10-26 Thread Gregor Gorjanc
Benjamin Dickgiesser dickgiesser at gmail.com writes:
...
 Is there an easy way to add a column name to the first column?

What about

summary.aggregate - function(y, ...)
{
  temp.mean - aggregate(y, FUN=mean, ...)
  temp.sd - aggregate(y, FUN=sd, ...)
  temp.length - aggregate(y, FUN=length, ...)
  temp - data.frame(cbind(col=names(y), mean=temp.mean$x, 
   stdev=temp.sd$x,n=temp.length$x))
}

or 

summary.aggregate - function(y, ...)
{
  temp.mean - aggregate(y, FUN=mean, ...)
  temp.sd - aggregate(y, FUN=sd, ...)
  temp.length - aggregate(y, FUN=length, ...)
  temp - data.frame(cbind(mean=temp.mean$x, 
   stdev=temp.sd$x,n=temp.length$x))
  rownames(temp) - names(y)
}

Gregor

__
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] Mixed conditional logit model

2006-10-25 Thread Gregor Gorjanc
Ryuichi Tamura ry.tamura at gmail.com writes:
 I wrote a collection of R functions for estimating discrete choice models 
 by simulated maximum likelihood. It includes:
...
 My R functions is based on GAUSS program listed in this site.

Have you considered to wrap all funcs in a package?

Gregor

__
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] Problem reading non-ISO data via read.csv2

2006-10-24 Thread Gregor Gorjanc
Hello!

I have a CSV file and when I try to import it into R with read.csv2 I
get the following error:

R read.csv2(file=pasme2.csv, na.strings=)
Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, na.strings
= character(0)) :
invalid multibyte string

There are some strange characters in it, but I never experienced such
behaviour. Actually, this file was produced with R (2.4.0) on Windows!
Utility file under Linux says:

$ file pasme2.csv
pasme.csv: Non-ISO extended-ASCII text

I am attaching few lines of a file for example. And mandatory info:

R version 2.4.0 (2006-10-03)
i486-pc-linux-gnu

locale:
LC_CTYPE=en_GB.UTF-8;LC_NUMERIC=C;LC_TIME=en_GB.UTF-8;LC_COLLATE=en_GB.UTF-8;LC_MONETARY=en_GB.UTF-8;LC_MESSAGES=en_GB.UTF-8;LC_PAPER=en_GB.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_GB.UTF-8;LC_IDENTIFICATION=C

-- 
Lep pozdrav / With regards,
Gregor Gorjanc
--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.
--
__
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] Problem reading non-ISO data via read.csv2

2006-10-24 Thread Gregor Gorjanc
Prof Brian Ripley wrote:
...
 There are some strange characters in it, but I never experienced such
 behaviour. Actually, this file was produced with R (2.4.0) on Windows!
 
 Well, then it cannot be a UTF-8 file (there are no UTF-8 locales on
 Windows, not any means to write a UTF-8 file here), and you have told R
 to read it in your UTF-8 locale.
 
 You need to specify the correct encoding: see ?file. But then you would
 have to do that in any application with such a text file, as an
 application could at best guess the encoding.

Thank you very much. Your suggestion solved my problem i.e. I have used:

read.csv2(file=file(pasme2.csv, encoding=WINDOWS-1252))

 Utility file under Linux says:

 $ file pasme2.csv
 pasme.csv: Non-ISO extended-ASCII text

 I am attaching few lines of a file for example. And mandatory info:
 
 No attached file appeared.

That is weird as my sent folder shows mail with an attachment. Anyway,
problem is solved now - with Your help!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc
--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] [Fwd: [AGDG-LIST:405] R Computing Contest]

2006-10-21 Thread Gregor Gorjanc


 Original Message 
Subject: [AGDG-LIST:405] R Computing Contest
Date: Sat, 21 Oct 2006 12:08:13 -0400
From: Larry Schaeffer [EMAIL PROTECTED]
Reply-To: [EMAIL PROTECTED]
To: Animal Geneticist's Discussion [EMAIL PROTECTED]

For those that are interested only:

R Computer Programming Challenge

Given:  y = Factor A + Factor B + b1(Covariate1) + b2(Covariate2) + ...
+ bp(Covariate p) + animal + e
where y is a single trait - vector of observations,
Factors A and B are fixed with ma and mb levels respectively,
Covariates 1 to p are fixed regressions and p is a general number but
less than 20.
Heritability is a variable and should be requested by the program.

You are given a list of the animal IDs of animals with records, and
their sires and dams.  Sire and dam
IDs are smaller than the IDs of their progeny, and all IDs go from 1 to
n where n can be up to 10 million
animals.

Tasks:
1) Estimate the EBVs of all animals using BLUP and mixed model equations
and
   list the top 10 largest EBVs with associated animal IDs,
   first ten levels of Factor A with solutions,
   first ten levels of Factor B with solutions,
   and all estimated regression coefficients.

Submit your R program to Bill Szkotnicki ([EMAIL PROTECTED]) by January
5, 2007.  Submissions
will be dated by their arrival date.  Provide any special functions or
details that might be needed to run your program.

All R programs will be run on the same test data sets, computer (Linux),
and timed.

Winner: Earliest submitted R program that runs the fastest and gives the
correct answers.

Prize: Free registration for the Kennedy Conference in 2008 in Guelph.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc
--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] object(s) are masked from package - what does it mean?

2006-10-21 Thread Gregor Gorjanc
tom soyer tom.soyer at gmail.com writes:

 
 Hi,
 
 Sometime when I attach a dataset, R gives me the following
 message/warning:The following object(s) are masked from package:datasets:
 column_name. Does anyone know what it means? Since it seems that the
 dataset was attached and I could manipulate the data from the dataset
 without problems, I am wondering what was R trying to tell me.

As far as I understand it: Imagine there is a package A with object tmp and you
load it. When you load another package B with object of the same name i.e. tmp
then you will access tmp from package B and not A. You might work though with
namespaces, :: and :::

Gregor

__
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] glm function question

2006-10-21 Thread Gregor Gorjanc
Chris Linton connect.chris at gmail.com writes:

 
 I am creating a model attempting to predict the probability someone will
 reoffend after being caught for a crime.  There are seven total inputs and I
 planned on using a logistic regression.  I started with a null deviance of
 182.91 and ended up with a residual deviance of 83.40 after accounting for
 different interactions and such.  However, I realized after that my code is
 different from that in my book.  And I can't figure out what I need to put
 in it's place.  Here's my code:
 
...
 fit1h = glm(reoff ~ factor(subst) + factor(violence) + prior +
 factor(violence):factor(subst) + factor(violence):factor(educ) +
 factor(violence):factor(age) + factor(violence):factor(prior))
 
 summary(fit1h)
 
 If you noticed, there's no part of my code that looks like:
 
 family=binomial(link=logit))
 
...
 
 However, when I do this, my null deviance is 1104 and my residual deviance
 is 23460.  THIS IS A HUGE DIFFERENCE IN MODEL FIT!  I'm not sure if I have
 to redo my model or if my book was simply doing the
 family=binomial(link=logit) for a specific problem/reason.

You state that you model the *probability* that ... Then family=gaussian, which
is the default data generation model in glm is not appropriate. Yes, you need to
use family=binomial(link=logit) or family=binomial(link=probit), but you
also need to take care in proper specification of your y in the glm call.

Gregor

__
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] winbugs - R question

2006-10-09 Thread Gregor Gorjanc
allan clark allan at stats.uct.ac.za writes:

 
 hi all
 
 i would like to use r and winbugs in order to undertake seemingly unrelated
regression. i am using the
 R2WINBUGS library. i just simulated a simple example (sample size is 25)  in
order to get the correct code.
 
 i suspect that the problem is in my definition of the prior. it wants a
multivariate node.

No solution, but just a note that this is more a question for (Win)BUGS list.
It is not very active recently, though.

Gregor

__
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] Transcript of Conservative ANOVA tables

2006-10-09 Thread Gregor Gorjanc
Dieter Menne dieter.menne at menne-biomed.de writes:

 
 Dear friends of lmer,
 
 http://wiki.r-project.org/rwiki/doku.php?id=guides:lmer-tests
 
 I have put a transcript of the long thread on lmer/lme4 statistical test
 into the Wiki. For all those who missed it life, and for those like me, who
 don't like the special style of the R-list to keep full length quotes.
 
 Creating the text there was not much fun, waiting times are simply
 unacceptable and the Wiki only give an empty page when syntax errors (for
 example from quotes) are detected.

I agree that there is a problem about waiting times with large pages. This
might be of interest for r-sig-wiki list, but I can not CC from Gmane - I will
send separate mail. I think there was discussion about this and that wiki is 
optimized for many small pages. I do agree though that having several pages for 
this transcript is not acceptable.

Gregor

__
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] Sweave, latex Warning

2006-10-07 Thread Gregor Gorjanc
Göran Broström goran.brostrom at gmail.com writes:

 
 When I am using Sweave to produce reports I get a strange Warning from latex:
 
 LaTeX Warning: You have requested package 
 `/usr/local/lib/R/share/texmf/Sweave'
but the package provides `Sweave'.
 
 It seems to be completely harmless, but I wonder if it is a symptom of
 installation problems, R or latex. How can I get rid of it?
 
 This is on linux (ubuntu), with R-2.4.0.

What do you actually use in Rnw file? Is it 

\usepackage{/usr/local/lib/R/share/texmf/Sweave}

or

\usepackage{Sweave}

I think this was discussed in r-devel list 
a while ago.

Gregor

__
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] sweave2html only for Linux users ?

2006-10-06 Thread Gregor Gorjanc
Laurent Rhelp laurentRhelp at free.fr writes:

 
 Dear R-List,
 
 I would like to convert my rnw files written with Sweave from LaTeX 
 to html. I discovered on the list the following link : 
 http://biostat.mc.vanderbilt.edu/twiki/bin/view/Main/SweaveConvert
 
 Is this document only for linux users or I can use it with windose XP ?
 


Maybe cygwin can be of help here.

Gregor

__
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] mcmcsamp-CI instead of P-values - references?

2006-10-06 Thread Gregor Gorjanc
Henrik Parn henrik.parn at bio.ntnu.no writes:

 
 Dear all,
 
 Given the discussions and issues of d.f., p-values and mcmcsamp-CIs in 
 mixed models, I wonder if anyone could recommend one or two papers (or 
 other citable sources for that sake) that summarizes the arguments 
 for/against P-values/mcCIs.
 
 I have followed the discussions on R-help and have learnt a lot (in my 
 naive non-statistician way). With all respect to all great 
 contributions, I may need published articles (if there are any), that 
 could be suitable to use in the Methods-section of a manuscript, to 
 motivate a no-p-values-but-some-nice-mcmcsampCIs-instead-approach!
 

Book (Bayesian Data Analysis) by Gelman et al. is very good source of this and 
much more. You might also find his papers and blog interesting

http://www.stat.columbia.edu/~gelman/
http://www.stat.columbia.edu/~gelman/blog/

Gregor

__
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] how to check object size in workspace

2006-10-06 Thread Gregor Gorjanc
Weiwei Shi helprhelp at gmail.com writes:

 
 hi,
 
 I tried to keep my workspace as small as possible when i tried to
 save.image(). Sometimes, I am not sure whether obj in workspace will
 be needed in future or not. However, I want to delete some big ones
 when I use save.image(). BTW, I know I could use save, but I would
 like to know : how to check objects' size (the size when I try to save
 it in disk) in workspace, anyway.
 

Take a look at

?object.size

and also in

?ll

in gdata package

Gregor

__
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] Adding graphics to R-help Files

2006-09-28 Thread Gregor Gorjanc
John James jjbarn at btinternet.com writes:

 
 Is there any way to add graphics (e.g. thumbnails in examples) to Rd files?
 
 A picture is worth a thousand words!

No. You can provide code example that works. That is quite close. You might also
look at 

http://bg9.imslab.co.jp/Rhelp/
http://addictedtor.free.fr/graphiques/

Gregor

__
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] Creating Movies with R

2006-09-25 Thread Gregor Gorjanc
Hello!

J.R. Lockwood lockwood at rand.org writes:
 
 An alternative that I've used a few times is the jpg() function to
 create the sequence of images, and then converting these to an mpeg
 movie using mencoder distributed with mplayer.  This works on both
 windows and linux.  I have a pretty self-contained example file
 written up that I can send to anyone who is interested.  Oddly, the
 most challenging part was creating a sequence of file names that would
 be correctly ordered - for this I use:
 
 lex - function(N){
   ## produce vector of N lexicograpically ordered strings
   ndig - nchar(N)
   substr(formatC((1:N)/10^ndig,digits=ndig,format=f),3,1000)
 }
 

RWiki[1] would be a very nice place for such explanation. I am looking forwrad 
to it!

Gregor

[1]http://wiki.r-project.org/

__
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] Conservative

2006-09-14 Thread Gregor Gorjanc
Douglas Bates bates at stat.wisc.edu writes:

 On 9/13/06, Dimitris Rizopoulos dimitris.rizopoulos at med.kuleuven.be
   I believe that the LRT is anti-conservative for fixed effects, as
   described in Pinheiro and Bates companion book to NLME.
  
  You have this effect if you're using REML, for ML I don't think there
  is any problem to use LRT between nested models with different
  fixed-effects structure.
...
 The other question is how does one evaluate the likelihood-ratio test
 statistic and that is the issue that Dimitris is addressing.  The REML
 criterion is a modified likelihood and it is inappropriate to look at
 differences in the REML criterion when the models being compared have
 different fixed-effects specifications, or even a different
 parameterization of the fixed effects.  However, the anova method for
 an lmer object does not use the REML criterion even when the model has
 been estimated by REML.  It uses the profiled log-likelihood evaluated
 at the REML estimates of the relative variances of the random effects.
  That's a complicated statement so let me break it down.
...

Is this then the same answer as given by Robinson:1991 (ref at the end) to
question by Robin Thompson on which likelihood (ML or REML) should be used
in testing the fixed effects. Robinson answered (page 49 near bottom 
right) that both likelihoods give the same conclusion about fixed effects. 
Can anyone comment on this issues? 

Thanks, Gregor

@Article{Robinson:1991,
  author =   {Robinson, G. K.},
  title ={That {BLUP} is a good thing: the estimation of random
  effects},
  journal =  ss,
  year = {1991},
  volume =   {6},
  number =   {1},
  pages ={15--51},
  keywords = {BLUP, example, derivations, links, applications},
  vnos = {GG}
}

__
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] Test internet presence

2006-09-12 Thread Gregor Gorjanc
Prof Brian Ripley ripley at stats.ox.ac.uk writes:
...
 Check out tests/internet.R.  nsl() checks if you can resolve host names, 
 which has worked well enough there.

Thank you prof. Ripley for this pointer. I am posting here the relevant part if
someone does not look at SVN. I would just like to ask why is .Platform$OS.type
== unix added to the test? Is nsl() available only on unix like platforms or
... I did not found any specifics in its help page.

if(!capabilities()[http/ftp]) {
warning(no internet capabilities)
q()
}

if(.Platform$OS.type == unix 
   is.null(nsl(cran.r-project.org))) q()

Does it make any sense to write a function that would use these two tests.

isNetAvailable - function()
{
  ifelse(!capabilities()[http/ftp]  
## .Platform$OS.type == unix  ## ??? 
 is.null(nsl(cran.r-project.org)), 
 FALSE, 
 TRUE)
}

Regards, Gregor

__
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] Test internet presence

2006-09-12 Thread Gregor Gorjanc
Gabor Grothendieck wrote:
 Here is a variation for Windows.  The second line returns TRUE or FALSE
 and may need to be varied if the output of ping is not the same on your
 system as on mine:
 
 ping - system(ping www.google.com, intern = TRUE)
 as.numeric(strsplit(grep(Received, ping, value = TRUE), [
 ,])[[1]][8])  0
 

...

Thank you Gabor and Ted! These are all fine ways, but as both of you
have stated not really general as you never know what ping will produce
on different versions etc. I am really keen on test from
tests/internet.R. If that test is OK for base R, I do not see why it
should not be OK for R package. I just hope to get some more feedback on
my question[1] to prof. Ripley.

[1]https://stat.ethz.ch/pipermail/r-help/2006-September/112766.html

Thank you!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Test internet presence

2006-09-12 Thread Gregor Gorjanc
Prof Brian Ripley wrote:
 On Mon, 11 Sep 2006, Gregor Gorjanc wrote:
 Prof Brian Ripley ripley at stats.ox.ac.uk writes:
 ...
 Check out tests/internet.R.  nsl() checks if you can resolve host names, 
 which has worked well enough there.
 Thank you prof. Ripley for this pointer. I am posting here the relevant part 
 if
 someone does not look at SVN. I would just like to ask why is 
 .Platform$OS.type
 == unix added to the test? Is nsl() available only on unix like platforms 
 or
 ... I did not found any specifics in its help page.
 
 Did you look at the help page on Windows?  Looking at the help page on 
 Unix only tells you about Unix.
 
 Hint: the help page is src/library/utils/man/unix/nsl.Rd
 
 (In my country, PhD students are supposed to be able to find things 
 like that out for themselves.)
 
 
...

Thank you for additional pointer. I did not look windows help page as I
do not have windows at disposal all the time, but You are right - I
should have looked into the sources. I found out that there is no such
function i.e. nsl() under windows.

If I summarize the thread there is (currently) no way to test for
internet presence with a general approach.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Matrix multiplication using apply() or lappy() ?

2006-09-11 Thread Gregor Gorjanc
Jeffrey J. Hallman jhallman at frb.gov writes:
 Tim Hesterberg timh at insightful.com writes:
 
  toby_marks at americancentury.com asked:
  I am trying to divide the columns of a matrix by the first row in the 
  matrix.
  
  Dividing columns of a matrix by a vector is a pretty fundamental
  operation, and the query resulted in a large number of suggestions:
  
  It is unsatisfactory when such a fundamental operation is
  done in so many different ways.  
  * It makes it hard to read other people's code.  
  * Some of these are very inefficient.

 But since you have no way to force people to use your new 'standard'
 operators, people can and will still use any of those myriad ways you decry to
 do the same thing.  It's part of the price you pay for working with a flexible
 system. 
 
 Besides, nothing will ever make it easy to read other people's code. 

Reading others code is never an easy task, but there are huge differences
between various authors and I agree with Tim, that it is nice to have some
standardized operators for common/fundamental operations. If there are standard
operators, people will use it more an more.

__
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] Test internet presence

2006-09-11 Thread Gregor Gorjanc
Hello useRs!

I have a small package and I need internet access for examples. Of
course it works fine when I have internet access, but not otherwise. I
remember I saw a way to test availability of internet access, but I can
not find it now in archives. Can anyone here help me?

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Test internet presence

2006-09-11 Thread Gregor Gorjanc
David Barron wrote:
 I means non-zero, not non-negative.
 
...

Thanks. download.file() is fine!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Test internet presence

2006-09-11 Thread Gregor Gorjanc
Gregor Gorjanc wrote:
 Hello useRs!
 
 I have a small package and I need internet access for examples. Of
 course it works fine when I have internet access, but not otherwise. I
 remember I saw a way to test availability of internet access, but I can
 not find it now in archives. Can anyone here help me?
 
 David Barron wrote:
 I means non-zero, not non-negative.

 ...
 
 Thanks. download.file() is fine!
 

Thinking a bit more, download.file() is not really general as I need to
specify an url and it might happen that I have internet connection, but
server that provides url is down. I am to picky on this?

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Test internet presence

2006-09-11 Thread Gregor Gorjanc
Gregor Gorjanc wrote:
 Gregor Gorjanc wrote:
 Hello useRs!

 I have a small package and I need internet access for examples. Of
 course it works fine when I have internet access, but not otherwise. I
 remember I saw a way to test availability of internet access, but I can
 not find it now in archives. Can anyone here help me?

 David Barron wrote:
 I means non-zero, not non-negative.

 ...

 Thanks. download.file() is fine!

 
 Thinking a bit more, download.file() is not really general as I need to
 specify an url and it might happen that I have internet connection, but
 server that provides url is down. I am to picky on this?

Additionally, download.file throws an error if url is not available i.e.
if I do not have internet access. I have used the following example:

if(download.file(url=http://www.r-project.org/index.html;,
 destfile=tempfile()) == 0) {
  print(Yuhuu)
}

unpluged the net cable and got the following message during R CMD check
(in examples part)

trying URL 'http://www.r-project.org/index.html'
Warning: unable to resolve 'www.r-project.org'.
Error in download.file(url = http://www.r-project.org/index.html;,
destfile = tempfile()) :
cannot open URL 'http://www.r-project.org/index.html'
Execution halted

It seems that 'internal' method was used (I use R 2.3.1 under Linux) as
indicated in help page of download.file. I could use wget or lynx
methods, but these two must be available, so this is not really
portable. Are there any other options for testing internet access? I am
thinking that this might be more relevant for R-devel. I will wait a bit
before moving there.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Comparison of R with proprietary software

2006-09-11 Thread Gregor Gorjanc
arin basu arinbasu at cashette.com writes:

 
 Hi All:
 
 Recently, I got a query how R compared cost-wise (cost of purchase,
maintenance, and training manuals)
 with other proprietary statistical software programs (or programming
environments). The request, verbatim:

Take a look at 


http://wiki.r-project.org/rwiki/doku.php?id=getting-started:translations:translations

and links from there!

Regards, Gregor

__
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] Test internet presence

2006-09-11 Thread Gregor Gorjanc
Thank you. Your solution is usable but unfortunatelly not portable to
Windows. I would like to use this test in package check, which can
include also windows OS.

 On 11-Sep-06 Ted Harding wrote:
 On 11-Sep-06 Gregor Gorjanc wrote:
 It seems that 'internal' method was used (I use R 2.3.1 under
 Linux) as indicated in help page of download.file. I could
 use wget or lynx methods, but these two must be available,
 so this is not really portable. Are there any other options
 for testing internet access? I am thinking that this might be
 more relevant for R-devel. I will wait a bit
 before moving there.

 -- 
 Lep pozdrav / With regards,
 Gregor Gorjanc
 Hi Gregor,
 Since you are using Linux, I think you should ask R to delegate
 the test to the system.

 If you have a script, in executable file (755) say test.inet.sh,
 which says something like
 
   if ping -c 1 something ; then
   export NET_UP=YES
 else
   export NETP_UP=NO
   fi
 
 where something is the IP address or name of an external host
 which responds to 'ping' (some will not, depending on their firewall
 settings), then you can use on R:

 system(test.inet)
 if( sys.getenv(NET_UP) == YES ) { ... } else { ... }
 
 system(test.inet.sh)
 if( sys.getenv(NET_UP) == YES ) { ... } else { ... }
 
 For example (nothing to do with R, but shows the principle),
 I have the following script to set my system time and hardware
 clock from whichever one of 3 NTP servers is willing to respond:

 if /bin/ping -c 1 ntp0.zen.co.uk ; then
 export NETTIME=/usr/sbin/ntpdate -u ntp0.zen.co.uk
   elif /bin/ping -c 1 ntp2b.mcc.ac.uk ; then
 export NETTIME=/usr/sbin/ntpdate -u ntp2b.mcc.ac.uk
   elif /bin/ping -c 1 ntp2c.mcc.ac.uk ; then
 export NETTIME=/usr/sbin/ntpdate -u ntp2c.mcc.ac.uk
   else
 export NETTIME=
 fi
 if [ $NETTIME !=  ] ; then
   sleep 1
   sleep 1
   $NETTIME
   /sbin/clock -u -w
   date
 fi


 which also illustrates how to allow for the possibility that
 the default server might not be responding at the time, so
 it has 2 fallback servers.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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 drop behavior -- set as option in later version?

2006-09-08 Thread Gregor Gorjanc
Balaji S. Srinivasan balajis at stanford.edu writes:
 ...
Hello,

I agree with you that you find yourself typing the same constructs over and
over. I think that we need to distinguish two modes of working with R. If you do
analysis, then you can really get tired of typing drop=FALSE, na.rm=TRUE etc.
But this things are very important when you are programming in R. Since these
two modes are not really separated in R I do not think this is an easy task, but
it would be great to have it. I had recently the same question for na.rm=TRUE.
But imagine how hard would it be to have two separate modes ... argh, probably a
mess^2 or have I missed something obvious.

 The possible caveats are:
 
 1) Performance issues associated with GetOption call (this is probably
 not a showstopper)
 2) Breaking old code which assumes drop=TRUE if the drop=FALSE option is set.
 
 For the latter situation, it would be possible to wrap any new code
 with an options setting as follows:
 
 og - options(GlobalDrop)
 options(GlobalDrop=FALSE)
 #new code here which assumes drop=FALSE
 options(og)

I think that local options i.e. drop=TRUE in code should override global ones.

Gregor

__
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 drop behavior -- set as option in later version?

2006-09-08 Thread Gregor Gorjanc
Martin Maechler wrote:
 Wrong Mailing List !!
 
 Proposals for changes to R should be discussed on R-devel, see
 the posting guide.
 I'll reply separately, but only CC to R-devel.

You are right, but I think that this might be an overkill. But, who am I
to decide that anyway! I actually excited that you noticed this thread
and find it usefull for r-devel discussion.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Producing R demos

2006-08-29 Thread Gregor Gorjanc
Hello!

I have found terrific demo or R package functionality at

http://had.co.nz/reshape/french-fries-demo.html

Author has told me off-list that he is using SnapzProX (on mac), and
ghostwriter (http://had.co.nz/ghostwriter/) to automate the typing.
Unfortunatelly, I do not have mac ;) Can anyone on the list suggest, how
such a demo (video + automated typing of a script) could be produced
under either Windows or Linux OS? I would like to create such a demo for
presentation as I will not be able to install R on the machine, but I
could play a movie.

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Producing R demos

2006-08-29 Thread Gregor Gorjanc
Gabor Grothendieck wrote:
 I have not used this but wink is a free demo-maker for Windows
 available at:
   http://www.debugmode.com/wink/
 Click the red on green arrow on that page to a (very short) demo.

Thanks! Do you perhaps also know equivalent of ghostwriter (link is
bellow) for windows/linux?

 On 8/29/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 Hello!

 I have found terrific demo or R package functionality at

 http://had.co.nz/reshape/french-fries-demo.html

 Author has told me off-list that he is using SnapzProX (on mac), and
 ghostwriter (http://had.co.nz/ghostwriter/) to automate the typing.
 Unfortunatelly, I do not have mac ;) Can anyone on the list suggest, how
 such a demo (video + automated typing of a script) could be produced
 under either Windows or Linux OS? I would like to create such a demo for
 presentation as I will not be able to install R on the machine, but I
 could play a movie.

 Thanks!


-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] day, month, year functions

2006-08-18 Thread Gregor Gorjanc
Gabor Grothendieck wrote:
 On 8/17/06, Martin Maechler [EMAIL PROTECTED] wrote:
  Gregor == Gregor Gorjanc [EMAIL PROTECTED]
  on Fri, 11 Aug 2006 00:27:27 + (UTC) writes:

[snip]

 
 There are two problems:
 
 1. as.POSIXlt is not generic.  (This problem may not be too important
 given that as.POSIXlt does handle Date and chron dates classes
 already but in terms of handling all potential classes its a limitation.)

But as.POSIXlt can be implemented as generic. Given the variatey of
potential classes this would be a reasonable move.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Setting contrasts for polr() to get same result of SAS

2006-08-17 Thread Gregor Gorjanc
T Mu muster at gmail.com writes:
 
 Hi all,
 
 I am trying to do a ordered probit regression using polr(), replicating a
 result from SAS.
 
 polr(y ~ x, dat, method='probit')
 
 suppose the model is y ~ x, where y is a factor with 3 levels and x is a
 factor with 5 levels,
 
 To get coefficients, SAS by default use the last level as reference, R by
 default use the first level (correct me if I was wrong),

Yes.

 I tried relevel, reorder, contrasts, but no success. I found what really
 matters is

I am sure those can help but you need to be carefull to reorder levels 
that the order is the same in SAS and R.

 options(contrasts = c(contr.treatment, contr.poly))
 
 or
 
 options(contrasts = c(contr.SAS, contr.poly))

You can also set contrasts directly to factors via

contrasts(x) - contr.SAS

where x is your factor. You can also set different contrasts to 
different factors.

Gregor

__
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] day, month, year functions

2006-08-17 Thread Gregor Gorjanc
Martin Maechler wrote:
 Gregor == Gregor Gorjanc [EMAIL PROTECTED]
 on Fri, 11 Aug 2006 00:27:27 + (UTC) writes:
 
 Gregor Gabor Grothendieck ggrothendieck at gmail.com writes:
  
  Here are three ways:
  
  xx - as.Date(2006-01-05)
  
  # 1. use as.POSIXlt
  as.POSIXlt(xx)$mday
  as.POSIXlt(xx)$mon + 1
  as.POSIXlt(xx)$year + 1900
  
  # 2. use format
  as.numeric(format(xx, %d))
  as.numeric(format(xx, %m))
  as.numeric(format(xx, %Y))
  
  # 3. use month.day.year in chron package
  library(chron)
  month.day.year(unclass(xx))$day
  month.day.year(unclass(xx))$month
  month.day.year(unclass(xx))$year
 
 Gregor Hi,
 
 Gregor it would really be great if there would be
 
 Gregor sec(), min(), hour() day(), month(), year()
 
 Gregor generic functions that would work on all date classes. Where
 Gregor applicable of course. I imagine that argument to get out integer
 Gregor or character would alse be nice.
 
 I disagree pretty strongly:
 
 - We definitely don't want min() to return minutes instead of
   minimum !
 

Pheu, a good catch. You are definitely right!

 - Why pollute the namespace with 6 (well, actualy 5!) new
   function names, when  as.POSIXlt()  
   *REALLY* is there exactly for this purpose ???

 I rather think the authors of each of the other old-fashioned
 date classes should provide as.POSIXlt() methods for their
 classes.
 
 Then, we'd have uniform interfaces, following's Gabor's # 1.
 above.

My proposal above was just a direction to a common way of dealing with
dates within R. If as.POSIXlt() methods is the way, that is perfectly
fine with me.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] mcmc pack

2006-08-10 Thread Gregor Gorjanc
Mariagiulia Matteucci matteucci at stat.unibo.it writes:

 
 Hello, 
 I would like to see the C++ code for the MCMC package, how can I do
 that?
 Thanks,

Hi,

- go to CRAN page i.e. http://cran.r-project.org/ or one of its mirros
- click on packages
- find MCMCpack and click on its link
- on MCMCpack page you will notice several links and one of them is *.tar.gz,
which is a source for the package - download and unpack that file and you are
in the bussines

Gregor

__
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] day, month, year functions

2006-08-10 Thread Gregor Gorjanc
Gabor Grothendieck ggrothendieck at gmail.com writes:
 
 Here are three ways:
 
 xx - as.Date(2006-01-05)
 
 # 1. use as.POSIXlt
 as.POSIXlt(xx)$mday
 as.POSIXlt(xx)$mon + 1
 as.POSIXlt(xx)$year + 1900
 
 # 2. use format
 as.numeric(format(xx, %d))
 as.numeric(format(xx, %m))
 as.numeric(format(xx, %Y))
 
 # 3. use month.day.year in chron package
 library(chron)
 month.day.year(unclass(xx))$day
 month.day.year(unclass(xx))$month
 month.day.year(unclass(xx))$year

Hi,

it would really be great if there would be

sec(), min(), hour() day(), month(), year()

generic functions that would work on all date classes. Where
applicable of course. I imagine that argument to get out integer
or character would alse be nice.

Gregor

__
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] Constrain coefs. in linear model to sum to 0

2006-08-09 Thread Gregor Gorjanc
Hello,

[EMAIL PROTECTED] wrote:
  
 Gorjanc Gregor asks:
 
 Hello!

 I would like to use constrain to sum coeficients of a factor to 0
 instead
 of classical corner contraint i.e. I would like to fit a model like

 lm(y ~ 1 + effectA + effectB)

 and say get parameters

 intercept
 effectA_1
 effectA_2
 effectB_1
 effectB_2
 effectB_3

 where effectA_1 represents deviation of level A_1 from intercept and 
 sum(effectA_1, effectA_2) = 0 and the same for factor B.

 Is this possible to do?
 
 Yes, but not quite as simply as you would like.  If you set
 
 options(contrasts = c(contr.sum, contr.poly))
 
 for example, then factor models are parametrised as you wish above,
 BUT you don't get all the effects directly
 
 In your case above, for example, if fm is the fitted model object, then
 
 coef(fm)
 
 Will give you intercept, effectA_2, effectB_2, effectB_3.  The
 remaining effects*_1 you will need to calculate as the negative of the
 sum of all the others.
 
 This gets a bit more complicated when you have crossed terms, a*b, but
 the same principle applies.

Thank you for the response. Peter Dalgaard already mentioned that I can
get missing coefs with taking negative of the sum of displayed coefs.
However, as you already noted that, things are complicated with crossed
terms. I was able to handle nested regression but did not had any luck
with interactions. For example:

### --- Picture of the model ---

if(FALSE) {
   | a1   | a2   |
--
b1 |  8   | 14   | 11
--
b2 | 13   | 17   | 15
--
b3 |  2   |  8   |  5
--
b4 |  4   | 10   |  7
--
   |  6.8 | 12.3 |
}

### --- Setup ---

N - 400
ab - c( 8, 13,  2,  4,
14, 17,  8, 10)
sigmaE - 0.01

levA - c(a1, a2)
facA - factor(sample(rep(levA, times=N / length(levA

levB - c(b1, b2, b3, b4)
facB - factor(sample(rep(levB, times=N / length(levB

table(facA, facB)

facAB - factor(paste(facA, facB, sep=-))
yAB - ab[as.integer(facAB)]

## Create design matrix and simulate y
tmp - model.matrix(~ facAB - 1)
y - tmp %*% as.matrix(ab) + rnorm(n=N, mean=0, sd=sigmaE)

contrasts(facA) - contr.sum
contrasts(facB) - contr.sum

### --- Fit the model ---

fit - lm(y ~ facA * facB, data=tmpData)
coefs - coef(fit)
(int - coefs[1])
(yMean - mean(y))

a - coefs[2]
(a - c(a, -a))
tapply(y, list(facA), mean)
tapply(y, list(facA), mean) - yMean
## Hmm, why is there such a big difference between mean values and
## coefs from the fit? I am doing something wrong here.

b - coefs[3:5]
(b - c(b, -sum(b)))
tapply(y, list(facB), mean)
tapply(y, list(facB), mean) - yMean
## Even more strange

(ab - coefs[6:8])
## [EMAIL PROTECTED]
tapply(y, list(facA, facB), mean)
tapply(y, list(facA, facB), mean) - yMean
## How can I proceed here?

## Using functions proposed by Martin Maechler:
fitAov - aov(y ~ facA * facB)
model.tables(fitAov, means, se=TRUE)
## vauuu, this is great
model.tables(fitAov, effects, se=TRUE)
## also nice and this fits with my raw mean test

What am I doing wrong then above with coefficients from the model?

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] if function and apply

2006-08-01 Thread Gregor Gorjanc
John Kane jrkrideau at yahoo.ca writes:
 I have a dataset just imported from SPSS.  It has any
 number of 99's as missing data and it looks like the
 next dataset will have custom missing codes. I have
 abouat 120 variables and an N of 2000.
 
...
 
 #  define function
 fn - function (x a) {

you need comma between x and a i.e. (x, a)
  ^

 if (x==a)return  (b) else x
 }

How can you return b, if b was not defined before

Gregor

__
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] zero values in LHS and RHS

2006-08-01 Thread Gregor Gorjanc
zubin binabina at bellsouth.net writes:

 
 Hello!
 
 I have a data set where i need to predict hotel stays in a 3 month 
 period by customer.  I have stays for each customer in the 3 month 
 period and the previous 3 month period + other variables.  these stays 
 contain an integer that ranges from 0 to 10.  classic poisson distribution.
 
 my question is around zeros.  usually we could take logs on the stays 
 and run an OLS model i think an enhancement would be to fit a poisson 
 GLM model.  i am confused about handling of zeros.  i will have zero 
 values on the RHS and potentially on the LHS.  It seems like the poisson 
 GLM model can handle zeros on the LHS and RHS.   i guess my question is 
 fitting a poisson GLM, are zeros allowed?  If so, how is this estimated 
 with a log link function?
 

I am not sure about the structure of LHS and RHS matrices, but yes, 
Poisson model can handle zeroes. If it turns out that there are to many 
zeroes as expected, you might try ZIP model.

Log link is the default for Poisson and it links the expected value of 
Poisson distribution and not the values itself.

Gregor

__
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] negative binomial lmer

2006-07-28 Thread Gregor Gorjanc
Ben Bolker bolker at ufl.edu writes:

...
  I haven't tried it, but you could also consider using
 a Poisson-lognormal (rather than neg binomial, which is Poisson-gamma)
 distribution, which might make this all work rather well
 in lmer:
 
 www.cefe.cnrs.fr/esp/TBElston_Parasitology2001.pdf

Actually it is very simple

lmer(y ~ effA + (1 | effB), family=quasipoisson)

i.e. this fits the following model

y_ijk ~ Poisson(\lambda_ijk)
log(lambda_ijk) = \mu + effaA_i + effB_ij + e_ijk
effB_i ~ Normal(0, \sigma^2_b)
e_ijk ~ Normal(0, \sigma^2_e)

Gregor

__
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] test

2006-07-23 Thread Gregor Gorjanc
just a test
-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Is there anywhere recycle()?

2006-07-23 Thread Gregor Gorjanc
Hello!

I am writting a function, which should recycle one of its arguments if
length of the argument is approprate i.e. something like

foo - function(x, a)
{
  n - length(x)
  if(length(a)  n) { # recycle a
oldA - a
a - vector(length=n)
a[1:n] - oldA
  }
  ## ...
  return(a)
}

foo(c(1, 2), a=c(1, 2))
foo(c(1, 2), a=c(1))

I am now wondering if there is any general/generic functions for such task.

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Is there anywhere recycle()?

2006-07-23 Thread Gregor Gorjanc
Hi,

Gabor Grothendieck wrote:
 Try:
 
 foo2 - function(x, a) cbind(x,a)[,2]
 

thank you for this. It does work to some extent, but not much better
than mine foo.

foo2(c(1, 2, 3), a=1)
[1] 1 1 1

18:14:08
R foo2(c(1, 2, 3), a=c(1,2,3,4))
[1] 1 2 3 4
Warning message:
number of rows of result
is not a multiple of vector length (arg 1) in: cbind(1, x, a)

18:14:13
R foo2(c(1, 2, 3), a=c(1,2,3))
[1] 1 2 3

18:14:18
R foo2(c(1, 2, 3), a=c(1,2))
[1] 1 2 1
Warning message:
number of rows of result
is not a multiple of vector length (arg 2) in: cbind(1, x, a)



 On 7/23/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 Hello!

 I am writting a function, which should recycle one of its arguments if
 length of the argument is approprate i.e. something like

 foo - function(x, a)
 {
  n - length(x)
  if(length(a)  n) { # recycle a
oldA - a
a - vector(length=n)
a[1:n] - oldA
  }
  ## ...
  return(a)
 }

 foo(c(1, 2), a=c(1, 2))
 foo(c(1, 2), a=c(1))

 I am now wondering if there is any general/generic functions for such
 task.

 Thanks!

 -- 
 Lep pozdrav / With regards,
Gregor Gorjanc

 --
 University of Ljubljana PhD student
 Biotechnical Faculty
 Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
 Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

 SI-1230 Domzale tel: +386 (0)1 72 17 861
 Slovenia, Europefax: +386 (0)1 72 17 888

 --
 One must learn by doing the thing; for though you think you know it,
  you have no certainty until you try. Sophocles ~ 450 B.C.

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



-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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 fit of a generic function

2006-07-19 Thread Gregor Gorjanc
Yes, that will do.

Thank you Gabor!

Gabor Grothendieck wrote:
 You could plot y vs. fitted(y.lm) where y.lm is the output of lm or
 plot both y and fitted(y.lm) against x on the same chart.
 
 
 On 7/18/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 Hello!

 Say I have a function, which creates a design matrix i.e.

 myFunc - function(x)
 {
  ret - cbind(x, x*x, x*x*x)
  colnames(ret) - 1:ncol(ret)
  return(ret)
 }

 n - 200
 x - runif(n=n, min=0, max=100)
 y - myFunc(x) %*% c(1, 0.2, -0.0002) +  rnorm(n=n, sd=100)

 then I can use this in formulae as here

 (fit - lm(y ~ myFunc(x)))

 Now I would like to plot data and fitted function on the plot, but I do
 not want to access each parameter estimate from object fit i.e. I
 would like to use something similar to abline for linear regression but
 in a generic way. Is there anything similar to my case?

 plot(y=y, x=x)

 ???plotMyFunc???

 Thanks!

 -- 
 Lep pozdrav / With regards,
Gregor Gorjanc

 --
 University of Ljubljana PhD student
 Biotechnical Faculty
 Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
 Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

 SI-1230 Domzale tel: +386 (0)1 72 17 861
 Slovenia, Europefax: +386 (0)1 72 17 888

 --
 One must learn by doing the thing; for though you think you know it,
  you have no certainty until you try. Sophocles ~ 450 B.C.

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



-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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 fit of a generic function

2006-07-18 Thread Gregor Gorjanc
Hello!

Say I have a function, which creates a design matrix i.e.

myFunc - function(x)
{
  ret - cbind(x, x*x, x*x*x)
  colnames(ret) - 1:ncol(ret)
  return(ret)
}

n - 200
x - runif(n=n, min=0, max=100)
y - myFunc(x) %*% c(1, 0.2, -0.0002) +  rnorm(n=n, sd=100)

then I can use this in formulae as here

(fit - lm(y ~ myFunc(x)))

Now I would like to plot data and fitted function on the plot, but I do
not want to access each parameter estimate from object fit i.e. I
would like to use something similar to abline for linear regression but
in a generic way. Is there anything similar to my case?

plot(y=y, x=x)

???plotMyFunc???

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Efficiency of subsetting with x[someCode] or test-someCode and x[test]

2006-07-06 Thread Gregor Gorjanc
Hello!

Does anyone have any knowledge on efficiency of subsetting via

x[someCode]

or

ind - someCode
x[ind]

In first approach I find it sometime cumbersome if someFunc() is
something complex i.e. long code, but it is short otherwise. I wonder if
assigning result to some indicator object is less efficient since
copies result is first stored and then reused. Is there any general
way with this that one should go for?

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Data in R for tag clouds

2006-06-28 Thread Gregor Gorjanc
Hello!

I have written function for tag clouds[1]. Currently it is in alpha
state and can be found at[2]. I would like to provide some data for this
in examples, but I would like to consider if there is any relevant data
for such a plot already in R so I can easily load it.

Btw. If anyone has any comments, suggestions, (check also [3]) etc.
please feel free to send them to me!

Thanks!

[1]http://en.wikipedia.org/wiki/Tag_cloud
[2]http://www.bfro.uni-lj.si/MR/ggorjan/software/R/index.html#tagCloud
[3]http://www.bfro.uni-lj.si/MR/ggorjan/software/R/tagCloud/TODO.txt
-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] R galleries

2006-06-20 Thread Gregor Gorjanc
Hello!

I just noticed new link on R wiki on R galleries and wanted to share
this info with YOU!

- R graphical manuals (this is awesome page as there are all help pages
of all packages on CRAN and probably even more and all graphics examples
are displayed! - more than 8000 images!)

http://bg9.imslab.co.jp/Rhelp/

This is a very nice addition to already existing R graph and movies
galleries

- R Graph Gallery
http://addictedtor.free.fr/graphiques/

- R Movies Gallery
http://addictedtor.free.fr/movies/

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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


Re: [R] Full or non constrained/reparametrized model.matrix

2006-05-10 Thread Gregor Gorjanc

Gabor thanks! Last suggestion works like charm!

Gabor Grothendieck wrote:
 On 5/9/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
 
 On 5/9/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
  Hello!
 
  Thank you very much for the response. Please read within the lines
 
  Gabor Grothendieck wrote:
   On 5/9/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
  
   Hello!
  
   I have parameter estimates for a generalized linear model and
 would like
   to produce fitted values i.e. fitted(). This can be easily done
 in R,
   but my problem lies in fact that I have a vector of parameters
 from some
   other software, that is is not constrained i.e. I have the following
   estimates for model with one factor with 4 levels
  
   beta = c(intercept group1 group2 group3 group4)
  
   where group1:4 are estimated deviations from intercept i.e. sum
 to zero
   contraint, but all parameter estimates are there! How can I create a
   model matrix that will not contain any constraints since I would
 like to
   compute
  
   model.matrix(some_formula) %*% beta
  
   I.e. I would like to have model.matrix of the form
  
   1 1 0 0 0
   1 0 1 0 0
   1 0 0 1 0
   1 0 0 0 1
  
   and not of the following form with contr.treatment or any other
   contraints
  
   1 0 0 0
   1 1 0 0
   1 0 1 0
   1 0 0 1
  
   I could remove group4 from beta and use sum to zero contraint for
   contrast in fomula, but I would like to overcome this, as my
 model can
   be richer in number or parameters. The following example, will
 show what
   I would like to do:
  
   ## --- Setup ---
  
   groupN - 4
   NPerGroup - 5
   min - 1
   max - 5
   g - runif(n = groupN, min = min, max = max)
  
   ## --- Simulate ---
  
   group - factor(rep(paste(G, 1:groupN, sep = ), each =
 NPerGroup))
   y - vector(mode = numeric, length = groupN * NPerGroup)
   j - 1
   for (i in 1:groupN) {
y[j:(i * NPerGroup)] - rpois(n = NPerGroup, lambda = g[i])
j - (i * NPerGroup) + 1
   }
  
   ## --- GLM ---
  
   contrasts(group) - contr.sum(groupN)
   fit - glm(y ~ group, family = poisson)
   coef(fit)
  
   ## Now this goes nicely
   model.matrix(y ~ group) %*% coef(fit)
  
   ## But pretend I have the following vector of estimated parameters
   beta - c(coef(fit), 0 - sum(coef(fit)[-1]))
   names(beta) - c(names(beta)[1:4], group4)
  
   ## I can not apply this as model matrix does not conform to beta
   model.matrix(y ~ group) %*% beta
  
  
   Try this:
  
   model.matrix(y ~ group-1) %*% beta[-1] + beta[1]
 
  This is a nice hack here, but does not work in general. Say I have
  another factor
 
  sex - factor(rep(paste(S, 1:2, sep = ), times=10))
 
  model.matrix(y ~ group + sex - 1)
 
  produces a matrix of 5 columns and not 6 as I want to.

 Try this:

 cbind(1, model.matrix(~group-1), model.matrix(~sex-1))

 
 In thinking about this a bit more, try this:
 
 attr(group, contrasts) - diag(nlevels(group))
 attr(sex, contrasts) - diag(nlevels(sex))
 model.matrix(~ group + sex)


-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Full or non constrained/reparametrized model.matrix

2006-05-09 Thread Gregor Gorjanc
Hello!

I have parameter estimates for a generalized linear model and would like
to produce fitted values i.e. fitted(). This can be easily done in R,
but my problem lies in fact that I have a vector of parameters from some
other software, that is is not constrained i.e. I have the following
estimates for model with one factor with 4 levels

beta = c(intercept group1 group2 group3 group4)

where group1:4 are estimated deviations from intercept i.e. sum to zero
contraint, but all parameter estimates are there! How can I create a
model matrix that will not contain any constraints since I would like to
compute

model.matrix(some_formula) %*% beta

I.e. I would like to have model.matrix of the form

1 1 0 0 0
1 0 1 0 0
1 0 0 1 0
1 0 0 0 1

and not of the following form with contr.treatment or any other contraints

1 0 0 0
1 1 0 0
1 0 1 0
1 0 0 1

I could remove group4 from beta and use sum to zero contraint for
contrast in fomula, but I would like to overcome this, as my model can
be richer in number or parameters. The following example, will show what
I would like to do:

## --- Setup ---

groupN - 4
NPerGroup - 5
min - 1
max - 5
g - runif(n = groupN, min = min, max = max)

## --- Simulate ---

group - factor(rep(paste(G, 1:groupN, sep = ), each = NPerGroup))
y - vector(mode = numeric, length = groupN * NPerGroup)
j - 1
for (i in 1:groupN) {
  y[j:(i * NPerGroup)] - rpois(n = NPerGroup, lambda = g[i])
  j - (i * NPerGroup) + 1
}

## --- GLM ---

contrasts(group) - contr.sum(groupN)
fit - glm(y ~ group, family = poisson)
coef(fit)

## Now this goes nicely
model.matrix(y ~ group) %*% coef(fit)

## But pretend I have the following vector of estimated parameters
beta - c(coef(fit), 0 - sum(coef(fit)[-1]))
names(beta) - c(names(beta)[1:4], group4)

## I can not apply this as model matrix does not conform to beta
model.matrix(y ~ group) %*% beta

## Is there any general way of constructing full design/model matrix
## without any constraints/reparametrizations?

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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


Re: [R] Full or non constrained/reparametrized model.matrix

2006-05-09 Thread Gregor Gorjanc
Hello!

Thank you very much for the response. Please read within the lines

Gabor Grothendieck wrote:
 On 5/9/06, Gregor Gorjanc [EMAIL PROTECTED] wrote:
 
 Hello!

 I have parameter estimates for a generalized linear model and would like
 to produce fitted values i.e. fitted(). This can be easily done in R,
 but my problem lies in fact that I have a vector of parameters from some
 other software, that is is not constrained i.e. I have the following
 estimates for model with one factor with 4 levels

 beta = c(intercept group1 group2 group3 group4)

 where group1:4 are estimated deviations from intercept i.e. sum to zero
 contraint, but all parameter estimates are there! How can I create a
 model matrix that will not contain any constraints since I would like to
 compute

 model.matrix(some_formula) %*% beta

 I.e. I would like to have model.matrix of the form

 1 1 0 0 0
 1 0 1 0 0
 1 0 0 1 0
 1 0 0 0 1

 and not of the following form with contr.treatment or any other
 contraints

 1 0 0 0
 1 1 0 0
 1 0 1 0
 1 0 0 1

 I could remove group4 from beta and use sum to zero contraint for
 contrast in fomula, but I would like to overcome this, as my model can
 be richer in number or parameters. The following example, will show what
 I would like to do:

 ## --- Setup ---

 groupN - 4
 NPerGroup - 5
 min - 1
 max - 5
 g - runif(n = groupN, min = min, max = max)

 ## --- Simulate ---

 group - factor(rep(paste(G, 1:groupN, sep = ), each = NPerGroup))
 y - vector(mode = numeric, length = groupN * NPerGroup)
 j - 1
 for (i in 1:groupN) {
  y[j:(i * NPerGroup)] - rpois(n = NPerGroup, lambda = g[i])
  j - (i * NPerGroup) + 1
 }

 ## --- GLM ---

 contrasts(group) - contr.sum(groupN)
 fit - glm(y ~ group, family = poisson)
 coef(fit)

 ## Now this goes nicely
 model.matrix(y ~ group) %*% coef(fit)

 ## But pretend I have the following vector of estimated parameters
 beta - c(coef(fit), 0 - sum(coef(fit)[-1]))
 names(beta) - c(names(beta)[1:4], group4)

 ## I can not apply this as model matrix does not conform to beta
 model.matrix(y ~ group) %*% beta
 
 
 Try this:
 
 model.matrix(y ~ group-1) %*% beta[-1] + beta[1]

This is a nice hack here, but does not work in general. Say I have
another factor

sex - factor(rep(paste(S, 1:2, sep = ), times=10))

model.matrix(y ~ group + sex - 1)

produces a matrix of 5 columns and not 6 as I want to.


 ## Is there any general way of constructing full design/model matrix
 ## without any constraints/reparametrizations?

 Thanks!

 -- 
 Lep pozdrav / With regards,
Gregor Gorjanc

 --
 University of Ljubljana PhD student
 Biotechnical Faculty
 Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
 Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

 SI-1230 Domzale tel: +386 (0)1 72 17 861
 Slovenia, Europefax: +386 (0)1 72 17 888

 --
 One must learn by doing the thing; for though you think you know it,
  you have no certainty until you try. Sophocles ~ 450 B.C.

 __
 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



-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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


Re: [R] Making R talk to Win/OpenBUGS in Linux (again)

2006-05-05 Thread Gregor Gorjanc
Hello Paul,

 Wow! That was quick.
 
 One more thing would make my R2WinBUGS experience more perfect.  I
 wish the bugs function explained how the user can write out the
 model.txt file from within the R code itself, rather than taking the
 current advice of creating it separately. The process now escribed in
 bugs is:
 
1.  Write a WinBUGS model in a ASCII file.
2.  Go into R.
 
 I don't know what the best way to create model.txt might be, but this
 does work, and maybe you have even better examples to show:
 
 myTextExample - c(  model {
for (j in 1:J){
  y[j] ~ dnorm (theta[j], tau.y[j])
  theta[j] ~ dnorm (mu.theta, tau.theta)
  tau.y[j] - pow(sigma.y[j], -2)
}
mu.theta ~ dnorm (0.0, 1.0E-6)
tau.theta - pow(sigma.theta, -2)
sigma.theta ~ dunif (0, 1000)
  }
 )
 
  zz - file(model.txt,w)
  writeLines(myTextExample,con=zz)
  close(zz)
 
 The only dicey part here is that the user might save the model in the
 wrong directory, but I don't see what prevents that with the current
 advice in bugs
 
 I suggest this because it allows the creation of one file working
 examples in R2WinBUGS.  For the teaching objective, this simplifies
 things a lot!

Perhaps you might try my function, which does this exactly as you
proposed. I added also a print function so you can print model nicely
also in R. You can find documentation
here

http://www.bfro.uni-lj.si/MR/ggorjan/software/R/ggmisc/ggmiscHtml/bugsModel.html

and the function itself lives in my offCRAN package ggmisc, which you
can grab at

http://www.bfro.uni-lj.si/MR/ggorjan/software/R/ggmisc.tar.gz

I already proposed this to Uwe, but he did not find it enough
interesting to include it into the R2WinBUGS. Anyway, Jouni Kerman,
has written even better function - fitbugs(). Look at link bellow for
more. I hope fitbugs() will make it into one of next releases of R2WinBUGS.

http://www.stat.columbia.edu/~kerman/Software/index.html

 
 
 On 5/4/06, Uwe Ligges [EMAIL PROTECTED] wrote:
 
 Paul Johnson wrote:


  Hello, and thanks for the many very rapid responses to my requests for
  R/WinBUGS conversation.
 
  I do not know how to build OpenBUGS in linux, but will snoop around
  and see if I can't figure out what's wrong with linking R to BRugs.so.
 
  In the meanwhile...
 
  While we are on the linux/bugs topic, can I please ask for a fix in
  R2WinBUGS? On my system, the script.txt file is written into the
  WinBUGS directory,where the user does not ordinarily have write
  permissions.  If script.txt could be written with the other temporary
  files, this would be solved.


 Will be fixed for the next release.
 We should also add some option to disable running bugs.update.settings()
 which really requires write access in the WinBUGS directory.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] [R-pkgs] New package connectedness

2006-05-02 Thread Gregor Gorjanc
Dear R users,

I would like to announce a new package connectedness on CRAN.
connectedness can be used to identify disconnected sets. It contains
functions to find, plot and subset disconnected sets in a two-way
classification without interaction.

Please do not hesitate to contact me, if you find a bug (possibly with a
patch) or you have any comments.

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

___
R-packages mailing list
[EMAIL PROTECTED]
https://stat.ethz.ch/mailman/listinfo/r-packages

__
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] How to specify function arguments that are used in different places

2006-05-01 Thread Gregor Gorjanc
Hello!

Subject is not very clear, but I hope my question will be;) I wrote a
function, which produces a plot and I have problems with arguments. For
the sake of example let us consider that my function looks like this

myfunc - function(x, points=FALSE, lines=FALSE, ...)
{
  ## x is an object that is being plotted
  plot(x$plotData, ...)
  ## one can also add some data on graph via points
  points(x$pointsData, ...)
  ## one can also add some data on graph via lines
  lines(x$linesData, ...)
}

My problem is in ... argument. plot(), points() and lines() have so
many possible arguments, which is very nice, but how can I deal with
them in my scenario. For example, I might want to specify red color for
plot, blue for points and green for lines. Is it possible to handle such
a mixture, without specifiying zillion of arguments such as plotCol,
pointsCol, linesCol etc.? Perhaps something like ~ points$...?

Thanks!

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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


Re: [R] Making R talk to Win/OpenBUGS in Linux (again)

2006-05-01 Thread Gregor GORJANC
Hello Jun,

On 5/1/06, jun yan [EMAIL PROTECTED] wrote:
 I have used linbugs with the rbugs package for a recent work. It might be
 worthwhile trying.

It would be very nice, if you would consider to port new funcionality in
rbugs to R2WinBUGS. I thought that this was your intention, when
wine part was added to R2WinBUGS. I do appreciate your package,
but find it weird to have two packages i.e. R2WinBUGS and rbugs for
exactly the same task. The issue with all this packages is really getting
very comples, now that BRugs is also availabe.

Please take this only as a humble suggestion.

Looking forward to hear from you.

--
Lep pozdrav / With regards,
Gregor Gorjanc


University of Ljubljana  PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3mail: gregor.gorjanc at bfro.uni-lj.si
SI-1230 Domzaletel: +386 (0)1 72 17 861
Slovenia, Europe fax: +386 (0)1 72 17 888

One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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


Re: [R] Making R talk to Win/OpenBUGS in Linux (again)

2006-04-30 Thread Gregor Gorjanc
 = 1000,bugs.directory = /usr/local/share/WinBUGS14/,
 working.directory = /tmp, clearWD = FALSE, useWINE=T, newWINE=T,
 WINE=/usr/bin/wine,WINEPATH=/usr/bin/winepath)
 
 
 
 I do have the binary /usr/bin/winepath, but can't tell how to give
 R2WinBUGS what it wants.  Many failed efforts below:
 
 
 
 schools.sim - bugs(data, inits, parameters, model.file, n.chains = 3, 
 n.iter = 1000,bugs.directory = /usr/local/share/WinBUGS14/, 
 working.directory = /tmp, clearWD = FALSE, useWINE=T, newWINE=T, 
 WINE=/usr/bin/wine,WINEPATH=/usr/bin/)
 
 Error in paste(WINEPATH, -w, x) : object WINEPATH not found
 
 schools.sim - bugs(data, inits, parameters, model.file, n.chains = 3, 
 n.iter = 1000,bugs.directory = /usr/local/share/WinBUGS14/, 
 working.directory = /tmp, clearWD = FALSE, useWINE=T, newWINE=T, 
 WINE=/usr/bin/wine)
 
 Error in if (!nchar(WINEPATH)) { : argument is of length zero
 
 schools.sim - bugs(data, inits, parameters, model.file, n.chains = 3, 
 n.iter = 1000,bugs.directory = /usr/local/share/WinBUGS14/, 
 working.directory = /tmp, clearWD = FALSE, useWINE=T, newWINE=T, 
 WINE=/usr/bin/wine,WINEPATH=/usr/bin)
 
 Error in paste(WINEPATH, -w, x) : object WINEPATH not found
 

 
 
 I know there are many unknowns here, but hope somebody has at least
 one working example that we can build on.


-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.
--
__
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] Remove [1] ... from output

2006-03-28 Thread Gregor Gorjanc
Hello!

I am writing some numbers and character vectors to an ascii file and
would like to get rid of [1] ... as shown bellow (a dummy example)

R runif(20)
 [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252 0.506480 0.547759
 [9] 0.912421 0.584382 0.987208 0.996846 0.666760 0.053637 0.327590 0.370737
[17] 0.505706 0.412316 0.887421 0.812151

I have managed to work up to remove quotes and all [*] except [1] as
shown bellow.

R print(paste(runif(20), collapse =  ), quote = FALSE)
[1] 0.790620362851769 0.45603066496551 0.563822037540376
0.812907998682931 0.726162418723106 0.37031230609864 0.681147597497329
0.29929908295162 0.209858040558174 0.304300333140418 0.105796672869474
0.743657597573474 0.409294542623684 0.825012607965618 0.282235795632005
0.21159387845546 0.620056127430871 0.337449935730547 0.754527133889496
0.280175548279658

Any hints how to solve my task?

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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


Re: [R] Remove [1] ... from output

2006-03-28 Thread Gregor Gorjanc
Thank you Adelchi and Ales!

Adelchi Azzalini wrote:
 On Tue, 28 Mar 2006 13:21:59 +0200, Gregor Gorjanc wrote:
 
 GG Hello!
 GG 
 GG I am writing some numbers and character vectors to an ascii file
 GG and would like to get rid of [1] ... as shown bellow (a dummy
 GG example)
 GG 
 GG R runif(20)
 GG  [1] 0.653574 0.164053 0.036031 0.127208 0.134274 0.103252
 GG  0.506480 0.547759 [9] 0.912421 0.584382 0.987208 0.996846
 GG  0.666760 0.053637 0.327590 0.370737
 GG [17] 0.505706 0.412316 0.887421 0.812151
 GG 
 GG I have managed to work up to remove quotes and all [*] except [1]
 GG as shown bellow.
 GG 
 GG R print(paste(runif(20), collapse =  ), quote = FALSE)
 GG [1] 0.790620362851769 0.45603066496551 0.563822037540376
 GG 0.812907998682931 0.726162418723106 0.37031230609864
 GG 0.681147597497329 0.29929908295162 0.209858040558174
 GG 0.304300333140418 0.105796672869474 0.743657597573474
 GG 0.409294542623684 0.825012607965618 0.282235795632005
 GG 0.21159387845546 0.620056127430871 0.337449935730547
 GG 0.754527133889496 0.280175548279658
 GG 
 GG Any hints how to solve my task?
 GG 
 
 what about 
   cat(format(runif(20)))
 ?
 
 you can improve it a bit with
 
  cat(format(runif(20)),\n)

-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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] Mixed-Effects Models in S and S-Plus (Springer)

2006-03-20 Thread Gregor Gorjanc
Hello!

Book by Pinheiro and Bates is being repeatedly suggested in connection
with lme() from nlme package. Is this book also suggested for a
reference use with lmer in lme4 package?
-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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


Re: [R] Mixed-Effects Models in S and S-Plus (Springer)

2006-03-20 Thread Gregor Gorjanc
Doran, Harold wrote:
 Well, not if you are interested in lmer() syntax. The book is good with
 the conceptual issues in modeling the data, but does not include any
 reference to fitting models with lmer. 

OK, I of course suspected that lmer will not be in, but I wanted to hear
that the book has good conceptual issues.

 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf Of Gregor Gorjanc
 Sent: Monday, March 20, 2006 8:58 AM
 To: [EMAIL PROTECTED]
 Subject: [R] Mixed-Effects Models in S and S-Plus (Springer)
 
 Hello!
 
 Book by Pinheiro and Bates is being repeatedly suggested in connection
 with lme() from nlme package. Is this book also suggested for a
 reference use with lmer in lme4 package?
 --
 Lep pozdrav / With regards,
 Gregor Gorjanc
 
 --
 University of Ljubljana PhD student
 Biotechnical Faculty
 Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
 Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si
 
 SI-1230 Domzale tel: +386 (0)1 72 17 861
 Slovenia, Europefax: +386 (0)1 72 17 888
 
 --
 One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.
 
 __
 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
 
 


-- 
Lep pozdrav / With regards,
Gregor Gorjanc

--
University of Ljubljana PhD student
Biotechnical Faculty
Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan
Groblje 3   mail: gregor.gorjanc at bfro.uni-lj.si

SI-1230 Domzale tel: +386 (0)1 72 17 861
Slovenia, Europefax: +386 (0)1 72 17 888

--
One must learn by doing the thing; for though you think you know it,
 you have no certainty until you try. Sophocles ~ 450 B.C.

__
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


  1   2   >