[R] extending family() objects

2006-05-19 Thread Simon.Bond
Dear R-help,

The family collection of objects is very useful since I can perform some
of the calculations involved when fitting glms easily in a vectorized
manner.

I would like to extend them in the following manner:  I want to supply a
vector of family names such as c(poisson, gamma,beta), and an
indexing vector such as c(1,1,1,1,1,1,2,2,2,2,3,3,3,3) ( integer elements
that go up to the length of the vector of family names).  I then want to
construct a new type of family object, new.family,  such that when calling
any of its functions, eg. family.new$variance(mu), it will apply a
different function according to the indexing vector.

I could do this quick-and-dirty using loops but I would really like not to
loose much of the speed obtained through vectorised calculations.

Any ideas?

Thanks

Simon Bond.

-
/\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
 X   - AGAINST MS ATTACHMENTS
/ \

http://www.gnu.org/philosophy/no-word-attachments.html

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

2005-09-27 Thread Simon.Bond
Dear R-help,


I was recently wanting to use GEE with the negative binomial family. It
seems that this is lacking in the otherwise excellent implementations of
the GEE methodology ( packages: gee, yags, geepack).

I would have thought it a simple step to allow the creation of a family,
i.e providing the link function (log mu) and the variance function (mu +
mu^2/theta) , assuming theta is specified; and then to let the gee code
do the business in a similar fashion to glm.

However the gee codes all seem to rely a set of C routines with either the
normal, poisson, or binomial, hardwired in.

Does anyone have any suggestions for a way round this problem for the
future (I had to resort to using Stata), or maybe more realistically, how
much work it would take to build an extendible version of the gee
algorithm?


thanks Simon Bond.

__
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] font sizes

2005-03-16 Thread Simon.Bond
Having experimented with both a sun workstation and a PC, changing
pointsize within the PC does have the desired effect, but it does nothing
within the Sun.

Unforutnately, the PC won't let me load the workspace I want (which
I normally  access through the sun) due to `lazy loading' errors.

Thinking more generally, although I think the ability to fine tune R
graphics is excellent, even superlative, what I would find really useful
is means to load a whole load of graphical settings in one go; one setting
to look at on-screen, one setting for written reports, one setting for
slides. Can anyone suggest a good way of going about this.

thanks Simon

On Tue, 15 Mar 2005, Uwe Ligges wrote:

 Simon.Bond wrote:

  I'm trying to use the pdf() function, and would like to increase the font
  size for slide-presentation  purposes. Changing the
  argument `pointsize' doesn't seem to do anything.
 
  Anyone come across this or know what to do?


 It does, e.g. compare pointsize=8 / pointsize=14

 If you want something different, maybe setting argument cex (and
 friends) in par() does what you want. See ?par.

 Uwe Ligges

  thanks
 
  Simon Bond.
 
  -
  /\
  \ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
   X   - AGAINST MS ATTACHMENTS
  / \
 
  http://www.gnu.org/philosophy/no-word-attachments.html
 
  __
  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



-
/\
\ /ASCII RIBBON CAMPAIGN - AGAINST HTML MAIL
 X   - AGAINST MS ATTACHMENTS
/ \

http://www.gnu.org/philosophy/no-word-attachments.html

__
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] impenetrable warning

2004-09-22 Thread Simon.Bond
Dear R-help,

Can anyone explain the meaning of  the warning,

Singular precision matrix in level -1, block 1

? Or how to track down where it comes from?

More precisely, using the nlme package, I'm issued with the warning

itt2 - lme(lrna~rx.nrti+lbrna, random=~1|patid,
cor=corExp(form=~days|patid,nugget=T), weights=varPower(
form=~lbrna),data=rna3)
Warning messages:
1: Singular precision matrix in level -1, block 1
2: Singular precision matrix in level -1, block 1

the output is:

Linear mixed-effects model fit by REML
  Data: rna3
  Log-restricted-likelihood: -4990.142
  Fixed: lrna ~ rx.nrti + lbrna
   (Intercept) rx.nrtiZDV+3TC rx.nrtiZDV+ABC  lbrna
 2.6597552  0.8589514  0.4259504  0.2929222

Random effects:
 Formula: ~1 | patid
(Intercept)  Residual
StdDev:1.251113 0.2105329

Correlation Structure: Exponential spatial correlation
 Formula: ~days | patid
 Parameter estimate(s):
  range  nugget
204.6422150   0.3349336
Variance function:
 Structure: Power of variance covariate
 Formula: ~lbrna
 Parameter estimates:
power
0.9733358
Number of Observations: 2390
Number of Groups: 124



Thanks,

Simon Bond.

__
[EMAIL PROTECTED] 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] Interpretation of poly(x, y, degree=2) coefficients

2004-07-20 Thread Simon.Bond
Does anyone know of a function that turns the coefficients of

lm( y~ poly(x1 , x2, degree=2))

into something that can be interpreted easily.  I was think along the
lines of the matrix representation of quadratic forms:

(x-mu)'A(x-mu) +k ,

and finding the eigenvectors/values of A, and the vector mu, but anything
that allows me to visualise a contour plot would be great.

Thanks

Simon Bond

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


[R] update/offset

2004-03-26 Thread Simon.Bond
I've noticed that the update() function does not seem to work correctly
when offset(..) terms are there:

update(modelwithoffset,  .~.-afixedeffect)

drops the offset term.

I'm using this with a negbin model, but I think it goes wrong with the
update.formula() function.

update.formula
function (old, new, ...)
{
env - environment(as.formula(old))
tmp - .Internal(update.formula(as.formula(old), as.formula(new)))
out - formula(terms.formula(tmp, simplify = TRUE))
environment(out) - env
return(out)
}
environment: namespace:base



The .Internal command in the code is where my efforts grind to a halt.


Any suggestions (apart from redefine the new model from scratch) ?

Thanks

Simon Bond.

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


[R] summary.nlme

2003-11-07 Thread Simon.Bond
Hi,


I'm trying to work out how the nlme function estimates the variances of
the fixed effects parameters, so I tried to look at the code for these
functions: summary.nlme, summary.lme, MEestimate.

 MEestimate
Error: Object MEestimate not found
 summary.nlme
Error: Object summary.nlme not found
 summary.lme
Error: Object summary.lme not found



So R says they don't exist, although summary(AnNlmeObject) works fine.


What's going on?


Simon Bond.

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