Displaying 20 results from an estimated 7000 matches similar to: "two problem in writing R functions"
2011 Feb 10
2
Comparison of glm.nb and negbin from the package aod
I have fitted the faults.data to glm.nb and to the function negbin from the
package aod. The output of both is the following:
summary(glm.nb(n~ll, data=faults))
Call:
glm.nb(formula = n ~ ll, data = faults, init.theta = 8.667407437,
link = log)
Deviance Residuals:
Min 1Q Median 3Q Max
-2.0470 -0.7815 -0.1723 0.4275 2.0896
Coefficients:
2005 Jun 30
1
RE : Dispersion parameter in Neg Bin GLM
Edward, you also can use the package aod on CRAN, see the help page of the function negbin.
Best
Matthieu
An example:
> library(aod)
> data(dja)
> negbin(y ~ group + offset(log(trisk)), ~group, dja, fixpar = list(4, 0))
Negative-binomial model
-----------------------
negbin(formula = y ~ group + offset(log(trisk)), random = ~group,
data = dja, fixpar = list(4, 0))
2008 Feb 26
2
Multiple lines with a different color assigned to each line (corrected code)
Sorry, I just realized I didn't type in the correct
names of the variables I am working with, this is how
it should be:
plot(1,1,type="n")
for (i in summ$tx) {
points(summ$timep[summ$tx==i],summ$mn[summ$tx==i])
lines(summ$timep[summ$tx==i],summ$mn[summ$tx==i])
}
Thank you,
Judith
____________________________________________________________________________________
2012 Sep 18
1
Cochran-Mantel-Haenszel test
Hello,
I have some satellite tag time-at-depth (TAD) frequency data that I
would like some help with.
The data was transmitted via satellite as percent time spent in each of
7 depth bins (0m, 0-1m, 1-10m, 10-50m etc.), binned over 6-hour
intervals. I categorized each row of data corresponding to a date and
time into summer vs. winter, and day vs. night, and then summed and
averaged the given
2003 Mar 12
2
quasipoisson, glm.nb and AIC values
Dear R users,
I am having problems trying to fit quasipoisson and negative binomials glm.
My data set
contains abundance (counts) of a species under different management regimens.
First, I tried to fit a poisson glm:
> summary(model.p<-glm(abund~mgmtcat,poisson))
Call:
glm(formula = abund ~ mgmtcat, family = poisson)
.
.
.
(Dispersion parameter
2014 Nov 28
2
[RFC PATCHv1] armv7: celt_pitch_xcorr: Introduce ARM neon intrinsics
Review comments inline.
> +if OPUS_ARM_NEON_INTR
> +noinst_LTLIBRARIES = libarmneon.la
> +libarmneon_la_SOURCES = $(CELT_SOURCES_ARM_NEON_INTR)
> +libarmneon_la_CPPFLAGS = $(OPUS_ARM_NEON_INTR_CPPFLAGS) -I$(top_srcdir)/include
> +endif
I don't think these should be in a separate library. It brings with it
lots of complications (to name one: wouldn't the .pc files need to
2014 Dec 09
1
[RFC PATCH v2] armv7: celt_pitch_xcorr: Introduce ARM neon intrinsics
Viswanath Puttagunta wrote:
> + SUMM = vdupq_n_f32(0);
It kills me that there's no intrinsic for VMOV.F32 d0, #0 (or at least I
couldn't find one), so this takes two instructions instead of one.
> + /* Consume 4 elements in x vector and 8 elements in y
> + * vector. However, the 8'th element in y never really gets
> + * touched in this loop. So, if len == 4,
2009 Apr 04
1
summary for negative binomial GLMs (PR#13640)
Full_Name: Robert Kushler
Version: 2.7.2
OS: Windows XP
Submission from: (NULL) (69.246.102.98)
I believe that the negative binomial family (from MASS) should be added to the
list for which dispersion is set to 1.
2008 Apr 22
3
Using the 'by' function within a 'for' loop
Dear R experts,
I am sorry for sending this email again. I would
imagine yesterday and maybe today, have been very busy
days with the release of R v 2.7.0. I join all the R
users who are very gratful for your contant work and
efforts, specially knowing that you are doing this for
the sake of science, without gettig any compensation
for that.
Having written that, I decided to send the
2013 Mar 07
3
ggpliot2: reordering of factors in facets facet.grid(). Reordering of factor on x-axis no problem.
Hi everyone (again),
before you all start screaming that the reordering of factors has been
discusse on several threads and is not particular to ggplot2, hear me out.
I can easily reorder my x-axis factor in facet.grid() in ggplot2. What I
cannot reorder are the factors represented on the strips. I can see that the
graphs are changing, so I am afraid of what it is I am doing. Why is ggplot2
2010 Apr 01
2
Adding regression lines to each factor on a plot when using ANCOVA
Dear R users,
i'm using a custom function to fit ancova models to a dataset. The data are
divided into 12 groups, with one dependent variable and one covariate. When
plotting the data, i'd like to add separate regression lines for each group
(so, 12 lines, each with their respective individual slopes). My 'model1'
uses the group*covariate interaction term, and so the coefficients
2005 Dec 07
1
Dots argument in apply method
Hello everyone,
I'm working on a package using S4 classes and methods and I ran into the
following "problem" when I tried to create an "apply" method for objects
of one of my new classes. I've found a way around the problem but I
wonder if I did not paint myself into the corner. I'd like your opinion
about that.
So I have an object "myObj" of class
2001 Sep 25
2
glm.nb, anova.negbin
Dear R-collegues,
I'm getting an error message (Error in round) when summarising a glm.nb
model, and when using anova.negbin (in R 1.3.1 for windows):
> m.nb <- glm.nb(tax ~ areal)
> m.bn
Call: glm.nb(formula = tax ~ areal, init.theta = 5.08829537115498,
link = log)
Coefficients:
(Intercept) areal
3.03146 0.03182
Degrees of Freedom: 283 Total (i.e. Null); 282
2007 Mar 30
2
Replacing slot of S4 class in method of S4 class?
Dear all,
Assume that I have an S4 class "MyClass" with a slot "myname", which
is initialized to: myname="" in method("initialize"):
myclass <- new("MyClass", myname="")
Assume that class "MyClass" has a method "mymethod":
"mymethod.MyClass" <-
function(object, myname=character(0), ...) {
2011 Oct 31
1
Question about copying reference objects using the initialize method
Dears,
I have a question about copying reference objects using the initialize method.
1) If the latter has no arguments, there is no problem to copy an object.
myClass = setRefClass("myClass", fields = list(value = "numeric") )
myClass$methods(initialize = function(...){
? value <<- 1
? callSuper(...)
})
newObject = myClass$new()
newObject$value = 2
copyObject =
2013 Jan 09
1
problem adding curve/abline
Hey,
I'm stuck on something I already did before (just a different kind of
database), and whatever I try, it doesn't work anymore. So thanks for your
help.
Here's how my data approximately looks like:
year season replicate size freq weight
2000 summer ch1 6 1 45
2000 summer ch1
2016 May 31
2
[PATCH 1/2] Modify autoconf tests for intrinsics to stop clang from optimizing them away.
---
configure.ac | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
diff --git a/configure.ac b/configure.ac
index a67aa37..c722556 100644
--- a/configure.ac
+++ b/configure.ac
@@ -472,6 +472,7 @@ AS_IF([test x"$enable_intrinsics" = x"yes"],[
[[
static float32x4_t A0, A1, SUMM;
SUMM = vmlaq_f32(SUMM, A0,
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
2008 Dec 22
1
How to add a slot to S4 class of an existing package?
Dear all,
Since my package is based on S4 classes, I would like to know how to add
a slot to an existing S4 class without breaking the code of users of my
package.
Assume the following S4 class:
setClass("MyClass",
representation(name = "character",
type = "character",
data = "data.frame"
),
prototype(name =
2013 Jun 18
2
offset en bucle
Amigos de la erre.
He creado mi primer bucle con for para entrenar unos modelos con GAM. La
respuesta es quasipoisson porque estoy trabajando con densidades de peces.
Sin embargo, tengo un problema, no se muy bien como aƱadir el offset a la
formula siguiente cuando creo el bucle.
GAM.A1 <-gam ((DYO)~s(DMA,k=4)+ s(WOD,k=4)+s(CIN,k=4)+s(DRA,k=4)+s(DBR,k=4)