Displaying 20 results from an estimated 10000 matches similar to: "size of a glm-like object"
2006 Nov 03
1
difference in using with() and the "data" argument in glm call
Dear all,
I am dealing with the following (apparently simple problem):
For some reasons I am interested in passing variables from a dataframe
to a specific environment, and in fitting a standard glm:
dati<-data.frame(y=rnorm(10),x1=runif(10),x2=runif(10))
KK<-new.env()
for(i in 1:ncol(dati)) assign(names(dati[i]),dati[[i]],envir=KK)
#Now the following two lines work correctly:
2004 Oct 26
2
vcov method for 'coxph' objects
Dear all,
The help file for the generic function vcov states
"Classes with methods for this function include: 'lm', 'glm', 'nls', 'lme',
'gls', 'coxph' and 'survreg' (the last two in package 'survival')."
Since, I am not able to use vcov.coxph(), I am wondering whether I am
missing something (as I suspect..)
regards,
vito
2001 Dec 03
1
fitting models with the subset argument
Hi all,
I'd like to fit model where the terms both are in the data.frame, mydata
say, and are vectors *not in the data.frame*.
>obj<-glm(y~x, data=mydata) #works
>Z<-pmax(mydata$x-20,0)
>(length(Z)==length(obj$y))
>[1] TRUE
>update(obj,.~.+Z) #works
However for some subset it doesn't works:
>obj<-glm(y~x, data=mydata, subset=f==1) #works
2007 Nov 12
2
how to extract the original data of a glm object
my function is
glm(a~log(b)+c+d+e,family=binomial,data=f)->aa
I want to extract the original data set of aa. How to do it ?
You may suggest the model.frame() function. In fact ,i have tried it.
model.frame returns a data frame of containing a,log(b) NOT b,c,d,e
I want to extract a data frame containing a,b,c,d,e,which is exactly the
same as "f"
How can I achieve this
2003 Apr 17
4
A function as argument of another function
Dear all,
I would like to write a function like:
myfun<-function(x,fn) {xx<-exp(x); x*fn(xx)}
where fn is a symbolic description of any function with its argument to be
specified. Therefore
myfun(5,"2+0.3*y^2")
should return 5*(2+0.3*exp(5)^2),
myfun(5,"log(y)") should return 5*log(exp(5)) and so on.
I tried with "expression" and others, but without success.
2006 Nov 03
1
[R] difference in using with() and the "data" argument in glm (PR#9338)
I've redirected this reply from r-help to the bugs list.
On 11/3/2006 8:25 AM, vito muggeo wrote:
> Dear all,
> I am dealing with the following (apparently simple problem):
> For some reasons I am interested in passing variables from a dataframe
> to a specific environment, and in fitting a standard glm:
>
> dati<-data.frame(y=rnorm(10),x1=runif(10),x2=runif(10))
>
2004 Nov 09
1
glm.nb stop on Error.
Hi,
I make an analysis sequence on R. In some cases the function glm.nb fail to
ajust the model. Its Ok. The problem is that this error stop the program. I
need treat this error and not stop the program. Something like this:
...
model <- glm.nb(y~x,maxit=1000)
if(glm.nb fail) {
teste[i] <- 0
}
else {
teste[i] <- anova(modelo)$"P(>|Chi|)"[2]
}
...
I try this:
...
2012 Apr 26
1
variable dispersion in glm models
Hello,
I am currently working with the betareg package, which allows the fitting of a variable dispersion beta regression model (Simas et al. 2010, Computational Statistics & Data Analysis). I was wondering whether there is any package in R that allows me to fit variable dispersion parameters in the standard logistic regression model, that is to make the dispersion parameter contingent upon
2006 Jan 31
1
warnings in glm (logistic regression)
Hello R users
I ran more than 100 logistic regression analyses. Some of the analyses gave
me this kind warning below.
###########################################################
Warning messages:
1: algorithm did not converge in: glm.fit(x = X, y = Y, weights = weights,
start = start, etastart = etastart, ...
2: fitted probabilities numerically 0 or 1 occurred in: glm.fit(x = X, y =
Y,
2002 Jul 02
1
two problem in writing R functions
Hi all,
Although I'm able to manage functions in R, because I'm writing my first
package I'd like to optmize them, but I'm not so expert to do it and I spent
a lot of my time without success. So I was wonder whether someone could give
me some advice. Let the function
myfn<-function(glm.obj,....){ #glm.obj is a glm object
.....
class(out)<- c("myclass",class(obj))
2003 Dec 16
3
`bivariate apply'
dear all,
Given a matrix A, say, I would like to apply a bivariate function to each
combination of its colums. That is if
myfun<-function(x,y)cor(x,y) #computes simple correlation of two vectors x
and y
then the results should be something similar to cor(A).
I tried with mapply, outer,...but without success
Can anybody help me?
many thanks in advance,
vito
2012 May 25
1
Breakpoint in logistic GLM with 'segmented' package - error: replacement length zero
Hello all,
I've been having trouble with assessing a breakpoint in a logistic GLM
with two explanatory variables. For this analysis I've been using the
'segmented' package version 0.2-9.1. But I keep getting an error and I
don't see where I would be going awry. The situation is the following:
Two explanatory variables:
bedekking - a variable with possible values between 0 and
2006 Jan 18
1
Breakpoints for multiple variables using Segmented
Hi all,
I am using the package ?Segmented? to estimate logistic regression models
with unknown breakpoints (see Muggeo 2003 Statistics in Medicine
22:3055-3071). In the documentation it suggests that it might be possible to
include several variables with breakpoints in the same model: ?Z = a vector
or a matrix meaning the (continuous) explanatory variable(s) having
segmented relationships with
2008 Jun 30
2
difference between MASS::polr() and Design::lrm()
Dear all,
It appears that MASS::polr() and Design::lrm() return the same point
estimates but different st.errs when fitting proportional odds models,
grade<-c(4,4,2,4,3,2,3,1,3,3,2,2,3,3,2,4,2,4,5,2,1,4,1,2,5,3,4,2,2,1)
score<-c(525,533,545,582,581,576,572,609,559,543,576,525,574,582,574,471,595,
557,557,584,599,517,649,584,463,591,488,563,553,549)
library(MASS)
library(Design)
2002 Sep 18
3
problem in deparse(substitute())
Hi all,
I am experiencing the following quite strange (at least in my knowledge)
problem in a simple function like the following:
fn<-function(y,v=2){
n<-length(y)
y<-y[(v+1):(n-v)]
plot(y,type="l",lty=3,xlab="Time",ylab=deparse(substitute(y)))
}
fn(rnorm(50)) #look at the plot!!!
The plot appears with numbers on the left side!
If I delete the
2012 Apr 02
7
Calculating NOEL using R and logistic regression - Toxicology
Hello, I used the glm function in R to fit a dose-response relationship and
then have been using dose.p to calculate the LC50, however I would like to
calculate the NOEL (no observed effect level), ie the lowest dose above
which responses start occurring. Does anyone know how to do this?
[[alternative HTML version deleted]]
2003 Mar 12
1
simulating 'non-standard' survival data
Dear all,
I'm looking for someone that help me to write an R function to simulate
survival data under complex situations, namely time-varying hazard ratio,
marginal distribution of survival times and covariates. The algorithm is
described in the reference below and it should be not very difficult to
implement it. However I tried but without success....;-(
Below there the code that I used; it
2008 Feb 19
1
Referencing to an object within a function
I am encountering an error when I attempt to reference a glm model
within a function. The function uses the segmented.glm command
(package = segmented). Within the segmented.glm command one specifies
an object, in this case a logistic regression model, and specifies a
starting threshold term (psi). I believe this is an environment
problem, but I do not have a solution. Any assistance
2006 Sep 13
3
unexpected result in glm (family=poisson) for data with an only zero response in one factor
Dear members,
here is my trouble: My data consists of counts of trapped insects in different attractive traps. I usually use GLMs with a poisson error distribution to find out the differences between my traitments (and to look at other factor effects). But for some dataset where one traitment contains only zeros, GLM with poisson family fail to find any difference between this particular traitment
2008 Aug 13
1
need help with stat functions(like adaboost, random forests and glm)
Ok, so basically I have a dataframe named data_frame
data_frame contains:
startdate
startprice
endpricethreshold1
endpricethreshold2
endpricethreshold3
all of these endpricethresholds are true/false binary vectors. They are
true or false depending on whether the endprice was above or below whatever
the endpricethreshold is.
now I want to try to use lets say the general linear model to have