similar to: Glm and user defined variance functions

Displaying 20 results from an estimated 1000 matches similar to: "Glm and user defined variance functions"

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)
2005 Jun 16
1
mu^2(1-mu)^2 variance function for GLM
Dear list, I'm trying to mimic the analysis of Wedderburn (1974) as cited by McCullagh and Nelder (1989) on p.328-332. This is the leaf-blotch on barley example, and the data is available in the `faraway' package. Wedderburn suggested using the variance function mu^2(1-mu)^2. This variance function isn't readily available in R's `quasi' family object, but it seems to me
2012 Apr 14
1
R Error/Warning Messages with library(MASS) using glm.
Hi there, I have been having trouble running negative binomial regression (glm.nb) using library MASS in R v2.15.0 on Mac OSX. I am running multiple models on the variables influencing the group size of damselfish in coral reefs (count data). For total group size and two of my species, glm.nb is working great to deal with overdispersion in my count data. For two of my species, I am getting a
2007 Sep 22
0
How to explain the meaning of mu in the variance function of GLMs?
Dear R friends, When fitting GLMs in R, we may need to specify the variance function to do our analysis. I had thought it's the mean value, but it seems not. Could anybody expain the correct meaning of *mu* in the variance function of GLMs? The following content is from the R-hlep. variance for all families other than quasi, the variance function is determined by the family. The quasi
2005 Jun 14
1
New Family object for GLM models...
Dear R-Users, I wish to create a new family object based on the Binomial family. The only difference will be with the link function. Thus instead if using the 'logit(u)' link function, i plan to use '-log(i-u)'. So far, i have tried to write the function following that of the Binomial and Negative Binomial families. The major problem i have here is with the definition of the
2002 Feb 27
1
Bug in glm.fit? (PR#1331)
G'day all, I had a look at the GLM code of R (1.4.1) and I believe that there are problems with the function "glm.fit" that may bite in rare circumstances. Note, I have no data set with which I ran into trouble. This report is solely based on having a look at the code. Below I append a listing of the glm.fit function as produced by my system. I have added line numbers so that I
2013 Apr 06
1
Plotting a curve for a Holling Type III Functional Response
Hey, So I have a scatter plot and I am trying to plot a curve to fit the data based on a Holling Type III functional response. My function is this: nll2<-function(a,b) { conefun<-(a*DBH^2)/(b^2+DBH^2) nlls2<-dnbinom(x=cones ,size=DBH, mu=conefun,log=TRUE) -sum(nlls) } and my plot is this: plot (DBH,cones) DBH is on the x-axis and cones is on the y-axis. How do I get the curve
2010 Nov 15
1
comparing levels of aggregation with negative binomial models
Dear R community, I would like to compare the degree of aggregation (or dispersion) of bacteria isolated from plant material. My data are discrete counts from leaf washes. While I do have xy coordinates for each plant, it is aggregation in the sense of the concentration of bacteria in high density patches that I am interested in. My attempt to analyze this was to fit negative binomial
2006 Jan 14
2
initialize expression in 'quasi' (PR#8486)
This is not so much a bug as an infelicity in the code that can easily be fixed. The initialize expression in the quasi family function is, (uniformly for all links and all variance functions): initialize <- expression({ n <- rep.int(1, nobs) mustart <- y + 0.1 * (y == 0) }) This is inappropriate (and often fails) for variance function "mu(1-mu)".
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
2013 Feb 28
3
Negative Binomial Regression - glm.nb
Dear all, I would like to ask, if there is a way to make the variance / dispersion parameter $\theta$ (referring to MASS, 4th edition, p. 206) in the function glm.nb dependent on the data, e.g. $1/ \theta = exp(x \beta)$ and to estimate the parameter vector $\beta$ additionally. If this is not possible with glm.nb, is there another function / package which might do that? Thank you very much for
2007 Feb 10
2
error using user-defined link function with mixed models (LMER)
Greetings, everyone. I've been trying to analyze bird nest survival data using generalized linear mixed models (because we documented several consecutive nesting attempts by the same individuals; i.e. repeated measures data) and have been unable to persuade the various GLMM models to work with my user-defined link function. Actually, glmmPQL seems to work, but as I want to evaluate a suite of
2011 Jul 26
1
nls - can't get published AICc and parameters
Hi I'm trying to replicate Smith et al.'s (http://www.sciencemag.org/content/330/6008/1216.abstract) findings by fitting their Gompertz and logistic models to their data (given in their supplement). I'm doing this as I want to then apply the equations to my own data. Try as a might, I can't quite replicate them. Any thoughts why are much appreciated. I've tried contacting the
2011 Apr 04
1
Clarks 2Dt function in R
Dear Ben, you answerd to Nancy Shackelford about Clarks 2Dt function. Since the thread ended just after your reply, I would like to ask, if you have an idea how to use this function in R I defined it the following way: function(x , p, u) { (p/(pi*u))*(1+(x^2/u))^(p+1) } and would like to fit this one to my obeservational data (count) [,1] [,2] [1,] 15 12 [2,] 45 13 [3,]
2003 Jan 16
3
Overdispersed poisson - negative observation
Dear R users I have been looking for functions that can deal with overdispersed poisson models. Some (one) of the observations are negative. According to actuarial literature (England & Verall, Stochastic Claims Reserving in General Insurance , Institute of Actiuaries 2002) this can be handled through the use of quasi likelihoods instead of normal likelihoods. The presence of negatives is not
2005 Aug 12
1
Help converting a function from S-Plus to R: family$weight
Hi all I am converting an S-Plus function into R. The S-Plus code uses some of the glm families, and family objects. The family objects in S-Plus and R have many different features, for example: In R: > names(Gamma()) [1] "family" "link" "linkfun" "linkinv" "variance" [6] "dev.resids" "aic"
2015 Dec 30
1
typo in src/library/stats/man/family.Rd: names of 'validmu' and 'valideta' ??
under "Details" (version 2015-11-29 r69717; not quite cutting-edge, but nothing has changed in src/library/stats/man/family.Rd in 5 months [sorry for using the Github mirror, but I prefer the interface ... <https://github.com/wch/r-source/blob/trunk/src/library/stats/man/family.Rd>]) it says: valid.mu: logical function. Returns ?TRUE? if a mean vector ?mu? is within the
2006 Apr 16
3
second try; writing user-defined GLM link function
I apologize for my earlier posting that, unbeknownst to me before, apparently was not in the correct format for this list. Hopefully this attempt will go through, and no-one will hold the newbie mistake against me. I could really use some help in writing a new glm link function in order to run an analysis of daily nest survival rates. I've struggled with this for weeks now, and can at least
2010 Jun 17
0
Modifyiing R working matrix within "gee" source code
Dear all, I am working on modifying the R working matrix to commodate some other correlations that not included in the package. I am having problem to locate where the R matrix are defined for regular matrices, i.e. independence, exchangeable, AR and unstructure. it might have something within .C("Cgee",but don't understand it well enough to know. Can you anyone help? /*gee source
2010 Nov 27
1
d.f. in F test of nested glm models
Dear all, I am fitting a glm to count data using poison errors with the log link. My goal is to test for the significance of model terms by calling the anova function on two nested models following the recommendation in Michael Crawley's guide to Statistical Computing. Without going into too much detail, essentially, I have a small overdispersion problem (errors do not fit the poisson