Displaying 20 results from an estimated 5000 matches similar to: "Defining own variance function / quasi-likelihood in a GLM"
2001 Nov 28
2
Why are looping variables not local?
Hello,
I've had a quick look on the list and can't find an answer to this niggle.
Whilst debugging some code, I noticed that looping variables in R are not
local to the loop as seams common in procedural languages.
For example consider the following piece of code:
for(i in 1:3){
cat(i,"")
for(i in c("a","b","c")){
cat(i,"")
2002 Apr 22
3
glm() function not finding the maximum
Hello,
I have found a problem with using the glm function with a gamma
family.
I have a vector of data, assumed to be generated by a gamma distribution.
The parameters of this gamma distribution are estimated in two ways (i)
using the glm() function, (ii) "by hand", using the optim() function.
I find that the -2*likelihood at the maximum found by (i) is substantially
larger than that
2003 Apr 02
8
lm with an arbitrary number of terms
Hello folks,
Any ideas how to do this?
data.frame is a data frame with column names "x1",...,"xn"
y is a response variable of length dim(data.frame)[1]
I want to write a function
function(y, data.frame){
lm(y~x1+...+xn)
}
This would be easy if n was always the same.
If n is arbitrary how could I feed the x1+...+xn terms into lm(response~terms)?
Thanks
Richard
--
Dr.
2005 Sep 27
3
quick "points" question
Hi
Just one of those niggles.......
I've just been trying to plot a filled circle.
I thought that this would do it
plot(1,1,type="n")
points(1,1,pch=1,bg="blue",cex=5)
#bg: background ("fill") color for open plot symbols
But I need to do this instead
points(1.2,1,pch=19,col="blue",cex=5)
Am I misunderstanding the "bg" option in the points
1999 May 29
2
Unexpected behaviour of read.table
When reading comma-delimited files as saved from a spreadsheet (unfortunately
many of my scientific collaborators give me these) in read.table(), missing
values are spotted most of the time. Unfortunately when comma is the first
character on the line it gets it wrong. For example, reading the file
1,,3
,5,6
,8,9
with
read.table("test.dat", header=F, sep=",")
R gives
1998 Mar 20
1
R-beta: Sun performance library
Has anyone tried to build R on Suns by linking to the versions of BLAS and
LINPACK in the Sun Performance Library rather than the standard versions
included in the distribution? On the face of it this would seem to be a highly
desirable thing to do since these versions of the routines are more efficient
and can exploit parallelism on multiprocessor machines.
David Clayton
MRC Biostatistics
2004 Apr 30
2
Code for quasi-likelihood binomial estimation
Hello,
Has anyone written up code to estimate for example a simple logit using
quasi-likelihood? I know that glm() already does this, but I'd like to do
some tinkering with the variance function beyond what glm() allows. I've
scanned online sources and everyone seems to use glm(). Will take a crack
at it if necessary but have zero experience w/q-likelihood and not that much
with
1997 Nov 14
1
R-beta: R in ESS with different -n and -v arguments
Is there any way of running R in ESS using -n and -v
arguments other than the default?
Thanks
Jonathan
--
Dr. Jonathan Myles e-mail:jonathan.myles at mrc-bsu.cam.ac.uk
MRC Biostatistics Unit Tel. 01223 330371
Institute of Public Health FAX 01223 330388
University Forvie Site
Robinson Way
CAMBRIDGE
CB2 2SR
2019 Apr 26
1
Error in glm(..., family=quasi(..., variance=list(...)))
In a glm() call using a quasi() family, one may define a custom variance function in the form of a "list containing components varfun, validmu, dev.resids, initialize and name" (quoting the help page for family). In trying to do so, I run into the following issue that I have not seen discussed previously:
x <- runif(1000, min=0, max=1)
y <- x + rnorm(1000, mean=0, sd=1)*x^(3/4)
2006 Jun 12
1
variance specification using glm and quasi
Hi all,
Cameron and Trivedi in their 1998 Regression Analysis of Count Data refer to
NB1 and NB2
NB1 is the negative binomial model with variance = mu + (alpha * mu^1)
yielding (1+alpha)*mu
NB2 sets the power to 2; hence, variance = mu + (alpha*mu^2)
I think that NB2 can be requested via
negbin2<-glm(hhm~sex+age,family=quasi(var="mu^2",link="log"))
Is
1997 Jul 19
1
R-beta: R without graphics
Is there a way to "unplug" the windows graphics from
R, so that it will work across a teletype telnet
session or in a Linux box proving resistant to having
windows added to it?
Thanks
Jonathan Myles
--
Dr. Jonathan Myles e-mail:jonathan.myles at mrc-bsu.cam.ac.uk
MRC Biostatistics Unit Tel. 01223 330371
Institute of Public Health FAX 01223 330388
University Forvie
1999 Jul 12
0
Error is dynamivally loaded code
Changing from 0.64.1 to 0.64.2 is causing some dynamically-loaded code to
crash with the message:
ld.so.1: /usr/local/lib/R/bin/R.binary:
fatal: relocation error: file /homef/jonm/glib/ggg/libs/glmm.so:
symbol R_chk_calloc: referenced symbol not found
(I've added carriage returns)
what am I doing wrong?
Jonathan
--
Dr. Jonathan Myles e-mail:jonathan.myles at mrc-bsu.cam.ac.uk
1999 Jun 07
0
R/C programming and documentation---thanks and summary
Thanks to everyone who helped with my query---Professors
Riply, Bates, Lumley, and Tim Keitt.
I said
<snip>
> My worries are
>
> a) That I've used calloc rather than S_alloc throughout.
Professors Bates and Ripley both pointed out that calloc
should be replaced by Calloc and free by Free,
which, I'll do.
----
I said:
> b) That I've used the following
2000 Jun 15
2
Checking the existence of a file
Is there a platform-independent way of checking in R whether a
given file exists in the user's filespace?
(so in a unix system, can you check within R whather, say,
/homef/jonm/thisfile
exists)
Thanks
Jonathan Myles
--
Dr. Jonathan Myles e-mail:jonathan.myles at mrc-bsu.cam.ac.uk
MRC Biostatistics Unit Tel. 01223 330372
Institute of Public Health FAX 01223 330388
2000 Jun 22
2
Intermediate LaTeX output generated by R CMD Rd2dvi
Is there any way of getting just the LaTex output which
R CMD Rd2dvi
generates on the way to produces a .dvi file,
which could then be incoorporated into another
document?
Thanks,
Jonathan
--
Dr. Jonathan Myles e-mail:jonathan.myles at mrc-bsu.cam.ac.uk
MRC Biostatistics Unit Tel. 01223 330372
Institute of Public Health FAX 01223 330388
University Forvie Site
1999 Jun 15
3
r help archives
Where are the archives of r-help kept, please?
Jonathan
--
Dr. Jonathan Myles e-mail:jonathan.myles at mrc-bsu.cam.ac.uk
MRC Biostatistics Unit Tel. 01223 330371
Institute of Public Health FAX 01223 330388
University Forvie Site
Robinson Way
CAMBRIDGE
CB2 2SR
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list --
1997 Jul 24
1
R-beta: dyn.load: incompatability between R and S
I have C routines in a collection of files
"/homef/jonm/postdocs/GLMM_project/Cprogs/nn/misc.o"
"/homef/jonm/postdocs/GLMM_project/Cprogs/nn/random.o"
"/homef/jonm/postdocs/GLMM_project/Cprogs/nn/ars.o"
... etc , where the third file includes functions which call
functions in the second.
In S, the function
> gload
function()
{
2005 Oct 13
0
nlme gls() error
Hello
I'm fitting a gls model with a variance-covariance structure and an
getting an error message I don't understand
I'm using gls() from the nlme library with the structure defined by
correlation = corSymm(form = ~1|Subject), weights = varIdent(form=~1|strata)
I get the error
Error in recalc.corSymm(object[[i]], conLin) :
NA/NaN/Inf in foreign function call (arg 1)
My
2005 Jun 02
1
glm with variance = mu+theta*mu^2?
How might you fit a generalized linear model (glm) with variance =
mu+theta*mu^2 (where mu = mean of the exponential family random variable
and theta is a parameter to be estimated)?
This appears in Table 2.7 of Fahrmeir and Tutz (2001) Multivariate
Statisticial Modeling Based on Generalized Linear Models, 2nd ed.
(Springer, p. 60), where they compare "log-linear model fits to
2005 Nov 28
3
glm: quasi models with logit link function and binary data
# Hello R Users,
#
# I would like to fit a glm model with quasi family and
# logistical link function, but this does not seam to work
# with binary data.
#
# Please don't suggest to use the quasibinomial family. This
# works out, but when applied to the true data, the
# variance function does not seams to be
# appropriate.
#
# I couldn't see in the
# theory why this does not work.
# Is