Re: [R] glm (probit/logit) optimizer

2012-10-05 Thread Ben Bolker
Dimitris.Kapetanakis gmail.com> writes: > I am using glm function in order to estimate a logit model i.e. glm(Y ~ > data[,2] + data[,3], family = binomial(link = "logit")). > > I also created a function that estimates logit model and I would like it to > compare it with the glm function. > > S

[R] glm (probit/logit) optimizer

2012-10-05 Thread Dimitris.Kapetanakis
Dear all, I am using glm function in order to estimate a logit model i.e. glm(Y ~ data[,2] + data[,3], family = binomial(link = "logit")). I also created a function that estimates logit model and I would like it to compare it with the glm function. So, does anyone know what optimizer or optimi

[R] GLM and Autocorrelation

2012-07-25 Thread MRB305
I am looking for a way to correct for autocorrelation using for my GLM models. I can identify the degree of autocorrelation, using PACF, but cannot figure out a way to specify which variables are the ones that are autocorrelated, and how to correct for this. Thank you for any help! -- View this

Re: [R] glm(weights) and standard errors

2012-05-28 Thread Steve Taylor
him about the survey package. -Original Message- From: peter dalgaard [mailto:pda...@gmail.com] Sent: Friday, 25 May 2012 9:37p To: ilai Cc: Steve Taylor; r-help@r-project.org Subject: Re: [R] glm(weights) and standard errors Weighting can be confusing: There are three standard forms of

Re: [R] glm(weights) and standard errors

2012-05-25 Thread peter dalgaard
gestion is the same as one of mine, and doesn't do what >> I'm looking for. >> >> >> -Original Message----- >> From: David Winsemius [mailto:dwinsem...@comcast.net] >> Sent: Tuesday, 22 May 2012 3:37p >> To: Steve Taylor >> Cc: r-help

Re: [R] glm(weights) and standard errors

2012-05-25 Thread ilai
rrected) suggestion is the same as one of mine, and doesn't do what > I'm looking for. > > > -Original Message- > From: David Winsemius [mailto:dwinsem...@comcast.net] > Sent: Tuesday, 22 May 2012 3:37p > To: Steve Taylor > Cc: r-help@r-project.org > S

Re: [R] glm(weights) and standard errors

2012-05-23 Thread Steve Taylor
2 3:37p To: Steve Taylor Cc: r-help@r-project.org Subject: Re: [R] glm(weights) and standard errors On May 21, 2012, at 10:58 PM, Steve Taylor wrote: > Is there a way to tell glm() that rows in the data represent a certain > number of observations other than one? Perhaps even fractional >

Re: [R] glm(weights) and standard errors

2012-05-21 Thread David Winsemius
On May 21, 2012, at 10:58 PM, Steve Taylor wrote: Is there a way to tell glm() that rows in the data represent a certain number of observations other than one? Perhaps even fractional values? Using the weights argument has no effect on the standard errors. Compare the following; is the

[R] glm(weights) and standard errors

2012-05-21 Thread Steve Taylor
Is there a way to tell glm() that rows in the data represent a certain number of observations other than one? Perhaps even fractional values? Using the weights argument has no effect on the standard errors. Compare the following; is there a way to get the first and last models to produce the s

Re: [R] glm convergence warning

2012-05-18 Thread Prof Brian Ripley
On 17/05/2012 20:35, Sophie Baillargeon wrote: Hi, When I run the following code : Y<- c(rep(0,35),1,2,0,6,8,16,43) cst<- log(choose(42, 42:1)) beta<- 42:1 tau<- (beta^2)/2 fit<- glm(formula = Y ~ offset(cst) + beta + tau, family = poisson) fit fit$converged glm prints a warning saying that th

Re: [R] glm convergence warning

2012-05-17 Thread Duncan Mackay
Hi Sophie It helps if you do some detective work Try fit1 <- glm(formula = Y ~ offset(cst) + beta + tau, family = poisson,trace = T, maxit = 200) and compare Regards Duncan Duncan Mackay Department of Agronomy and Soil Science University of New England Armidale NSW 2351 Email: home: mac...

[R] glm convergence warning

2012-05-17 Thread Sophie Baillargeon
Hi, When I run the following code : Y <- c(rep(0,35),1,2,0,6,8,16,43) cst <- log(choose(42, 42:1)) beta <- 42:1 tau <- (beta^2)/2 fit <- glm(formula = Y ~ offset(cst) + beta + tau, family = poisson) fit fit$converged glm prints a warning saying that the algorithm did not converge. However, fit$

[R] GLM & other machine learning packages for ffdf formats

2012-04-15 Thread Indrajit Sengupta
Hi All,   I have 1 GB dataset in ffdf format. Is there any package / machine learning algorithms available that I can apply on these ffdf format datasets?   Regards, Indrajit [[alternative HTML version deleted]] __ R-help@r-project.org mailing l

Re: [R] glm: getting the confidence interval for an Odds Ratio, when using predict()

2012-03-21 Thread Dominic Comtois
risks <- inv.logit(predict(model,newd)) risk.diff <- risks[2] - risks[1] Many thanks, Dominic C. 2012/3/20 Dominic Comtois > Case solved. Thanks a lot Peter! > > Dominic C. > > > -Message d'origine- > De : peter dalgaard [mailto:pda...@gmail.com] > Envo

Re: [R] glm: getting the confidence interval for an Odds Ratio, when using predict()

2012-03-20 Thread Dominic Comtois
Case solved. Thanks a lot Peter! Dominic C. -Message d'origine- De : peter dalgaard [mailto:pda...@gmail.com] Envoyé : 20 mars 2012 07:57 À : Dominic Comtois Cc : r-help@r-project.org help Objet : Re: [R] glm: getting the confidence interval for an Odds Ratio, when using pr

Re: [R] glm: getting the confidence interval for an Odds Ratio, when using predict()

2012-03-20 Thread peter dalgaard
[Oops, forgot cc. to list] On Mar 20, 2012, at 04:40 , Dominic Comtois wrote: > I apologize for the errors in the previous code. Here is a reworked example. > It works, but I suspect problems in the se calculation. I changed, from the > 1st prediction to the 2nd only one covariate, so that the

Re: [R] glm: getting the confidence interval for an Odds Ratio, when using predict()

2012-03-19 Thread Dominic Comtois
I apologize for the errors in the previous code. Here is a reworked example. It works, but I suspect problems in the se calculation. I changed, from the 1st prediction to the 2nd only one covariate, so that the OR's CI should be equal to the exponentiated variable's coefficient and ci. And we get s

Re: [R] glm: getting the confidence interval for an Odds Ratio, when using predict()

2012-03-19 Thread peter dalgaard
On Mar 19, 2012, at 22:32 , Dominic Comtois wrote: > Thanks for your answer, much appreciated. > > This ain't trivial indeed. I worked my way through it, until I got a "non > conformable arguments" error when trying to calculate the new standard error. > Since I'm not following 100% what's hap

Re: [R] glm: getting the confidence interval for an Odds Ratio, when using predict()

2012-03-19 Thread Dominic Comtois
Thanks for your answer, much appreciated. This ain't trivial indeed. I worked my way through it, until I got a "non conformable arguments" error when trying to calculate the new standard error. Since I'm not following 100% what's happening, it's hard for me to figure out what I should do next. He

Re: [R] glm: getting the confidence interval for an Odds Ratio, when using predict()

2012-03-19 Thread peter dalgaard
On Mar 19, 2012, at 03:32 , Dominic Comtois wrote: > Say I fit a logistic model and want to calculate an odds ratio between 2 > sets of predictors. It is easy to obtain the difference in the predicted > logodds using the predict() function, and thus get a point-estimate OR. But > I can't see how

[R] glm: getting the confidence interval for an Odds Ratio, when using predict()

2012-03-18 Thread Dominic Comtois
Say I fit a logistic model and want to calculate an odds ratio between 2 sets of predictors. It is easy to obtain the difference in the predicted logodds using the predict() function, and thus get a point-estimate OR. But I can't see how to obtain the confidence interval for such an OR. For exa

Re: [R] Glm and user defined variance functions

2012-03-14 Thread Ben Bolker
Craig Lyon rogers.com> writes: > > Hi, > > I am trying to run a generalized linear regression using a negative binomial > error distribution. However, I want to use an overdispersion parameter that > varies (dependent on the length of a stretch of road) so glm.nb will not do. > > >From what I'

[R] Glm and user defined variance functions

2012-03-14 Thread Craig Lyon
Hi, I am trying to run a generalized linear regression using a negative binomial error distribution. However, I want to use an overdispersion parameter that varies (dependent on the length of a stretch of road) so glm.nb will not do. >From what I've read I should be able to do this using GLM by s

Re: [R] GLM with regularization

2012-03-01 Thread Dmitriy Lyubimov
Thank you. On Thu, Mar 1, 2012 at 9:58 AM, Bert Gunter wrote: > Google is your friend! -- as usual. > > If you had searched on "glm with regularization" you would have bumped > into the glmnet R package, which I think is what you're looking for. > > -- Bert > > On Wed, Feb 29, 2012 at 6:22 PM, Dm

Re: [R] GLM with regularization

2012-03-01 Thread Bert Gunter
Google is your friend! -- as usual. If you had searched on "glm with regularization" you would have bumped into the glmnet R package, which I think is what you're looking for. -- Bert On Wed, Feb 29, 2012 at 6:22 PM, Dmitriy Lyubimov wrote: > Hello, > > Thank you for probably not so new questio

[R] GLM with regularization

2012-02-29 Thread Dmitriy Lyubimov
Hello, Thank you for probably not so new question, but i am new to R. Does any of packages have something like glm+regularization? So far i see probably something close to that as a ridge regression in MASS but I think i need something like GLM, in particular binomial regularized versions of poly

Re: [R] GLM - guess the distribution of the response variable

2012-02-09 Thread Bert Gunter
Below. -- Bert On Thu, Feb 9, 2012 at 9:06 AM, David Winsemius wrote: > > On Feb 9, 2012, at 7:32 AM, wo...@posteo.de wrote: > >> Dear all, >> >> I have question regarding GLMs: >> I have a discrete response variable and a continuous explaining variable. >> Like this: >> http://www.myimg.de/?img=

Re: [R] GLM - guess the distribution of the response variable

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 7:32 AM, wo...@posteo.de wrote: Dear all, I have question regarding GLMs: I have a discrete response variable and a continuous explaining variable. Like this: http://www.myimg.de/?img=example1db0f.jpg I want to use a GLM to investigate. I have to specify the "familiy o

[R] GLM - guess the distribution of the response variable

2012-02-09 Thread wonko
Dear all, I have question regarding GLMs: I have a discrete response variable and a continuous explaining variable. Like this: http://www.myimg.de/?img=example1db0f.jpg I want to use a GLM to investigate. I have to specify the "familiy of the distribution of the response variable" - or, maybe

[R] GLM Quasibinomial - 48 models

2012-02-07 Thread Jhope
I've originally made 48 GLM binomial models and compare the AIC values. But dispersion was very large: Example: Residual deviance: 8811.6 on 118 degrees of freedom I was suggested to do a quasibinomial afterwards but found that it did not help the dispersion factor of models and received a warn

[R] glm()

2012-02-04 Thread Sherlene Enriquez-Savery
I want to run the glm () function for my data but instead of using the family distributions in R, I need the 4P Burr distribution. Can some please explain how can I go about doing that. Or please provide me with an example. I‘m new to R. Eg. Model1 <- glm(Postwt ~ Prewt + Treat + offset(Pr

[R] GLM - fixed responses?

2012-01-19 Thread Jhope
Hi everyone, I just did a GLM binomial regression. I am wondering how do I know when my responses are fixed? I have found that an interaction between two factors is the most significant predictor amongst other factors by comparing the AIC and add1 with each factor. Does this mean that the inter

Re: [R] glm or transformation of the response?

2012-01-07 Thread Rolf Turner
On 08/01/12 05:54, emily wrote: Hi Dr. Snow, This is the r-help mailing list, not Greg Snow's private email. If you just want to email Dr. Snow, then email *him* (his address was given in the post to which you replied). I am not using R at the moment (working in SPSS, have to love the GUI)

Re: [R] glm or transformation of the response?

2012-01-07 Thread Joshua Wiley
Hi Emily, This is the R-help forum---it is for R questions, not basic statistics. You should check out http://stats.stackexchange.com/ for those type of questions. glm(log(y) ~ x, poisson(link = "identity")) is not the same as glm(y ~ x, poisson(link = "log")), so I am not surprised you are gett

Re: [R] glm or transformation of the response?

2012-01-07 Thread emily
Hi Dr. Snow, I am a graduate student working on analyzing data for my thesis and came across your post on an R forum: The default link function for the glm poisson family is a log link, which means that it is fitting the model: log(mu) ~ b0 + b1 * x But the data that you generate is b

Re: [R] glm predict issue

2011-12-26 Thread Giovanni Azua
Hi Ben, Yes thanks you are right, I was able to fix it but first I had to fix the data frame over which I built my model to use numeric for those and then making the grid values also numeric it finally worked thanks! Thank you for your help! Best regards, Giovanni On Dec 26, 2011, at 4:57 PM,

Re: [R] glm predict issue

2011-12-26 Thread Ben Bolker
Giovanni Azua gmail.com> writes: > > Hello, > > I have tried reading the documentation and googling for the answer but reviewing the online matches I end up > more confused than before. > > My problem is apparently simple. I fit a glm model (2^k experiment), and then I would like to predict th

Re: [R] glm predict issue

2011-12-26 Thread Weidong Gu
Hi, This might be due to the fact that factor levels are arbitary unless they are ordinal, even that quantitative relationships between levels are unclear. Therefore, the model has no way to predict unseen factor levels. Does it make sense to treat 'No_databases' as numeric instead of a factor va

[R] glm predict issue

2011-12-26 Thread Giovanni Azua
Hello, I have tried reading the documentation and googling for the answer but reviewing the online matches I end up more confused than before. My problem is apparently simple. I fit a glm model (2^k experiment), and then I would like to predict the response variable (Throughput) for unseen fact

Re: [R] glm step() fkt

2011-11-30 Thread R. Michael Weylandt
Put them in a list: ModelList <- vector("list", 100) ModelList[[i]] <- mod.step <- step(mod, direction="both",trace=T) Then come back and use sapply() to do whatever you want to the set of models to compare/count/etc them Michael On Wed, Nov 30, 2011 at 6:12 AM, Schrabauke wrote: > Hi

[R] glm step() fkt

2011-11-30 Thread Schrabauke
Hi volks, i have a question about the step() fkt. Is there a possibility to save the last model generated from this method. I have a loop and so i generate 100 different models with the step fkt and i want to know which model is the most common. CODE: ... missStep -> numeric(100) for (j in 1:10

Re: [R] GLM Help

2011-10-28 Thread Weidong Gu
Are you sure your variables are categorical or numeric? Of course, glm differentiates these two kinds of variables. For example, I ran the same variable with different modes, the results are very different. > dat<-data.frame(y=rpois(100,5),xf=as.factor(sample(1:4,100,replace=T))) > glm(y~xf,data=d

[R] GLM Help

2011-10-28 Thread CES
Hey all, I am attempting to replicate my results achieved in another program within R (so I can expand my options for methods). I am trying to run a GLM (Family = Poisson) for count data in R. Some of my variables are factors and I am under the impression that the function glm() cannot run a mode

Re: [R] glm-poisson fitting 400.000 records

2011-10-24 Thread D_Tomas
Many thanks for your replies. I appreciate that. I tried what you suggested and it did work for the Poisson model (glm, "poisson" familly). Unfortunately, the negative binomial (glm.nb) did not work as I work the following message: Warning messages: 1: In ifelse(y > mu, d.res, -d.res) : Reache

Re: [R] glm-poisson fitting 400.000 records

2011-10-22 Thread Uwe Ligges
On 21.10.2011 23:14, Ken wrote: Your memory shouldn't be capped there, Where? You cannot know from the output below. try ?memory.size and ?memory.limit. Background less things. Good luck, Ken Hutchison On Oct 21, 2554 BE, at 11:57 AM, D_Tomas wrote: My apologies for my vague

Re: [R] glm-poisson fitting 400.000 records

2011-10-21 Thread Ken
Your memory shouldn't be capped there, try ?memory.size and ?memory.limit. Background less things. Good luck, Ken Hutchison On Oct 21, 2554 BE, at 11:57 AM, D_Tomas wrote: > My apologies for my vague comment. > > My data comprises 400.000 x 21 (17 explanatory variables, plus response

Re: [R] glm-poisson fitting 400.000 records

2011-10-21 Thread D_Tomas
My apologies for my vague comment. My data comprises 400.000 x 21 (17 explanatory variables, plus response variable, plus two offsets). If I build the full model (only linear) I get: Error: cannot allocate vector of size 112.3 Mb I have a 4GB RAM laptop... Would i get any improvemnt on a 8G

Re: [R] glm-poisson fitting 400.000 records

2011-10-21 Thread Ben Bolker
D_Tomas hotmail.com> writes: > > Hi, > > I am trying to fi a glm-poisson model to 400.000 records. I have tried biglm > and glmulti but i have problems... can it really be the case that 400.000 > are too many records??? > > I am thinking of using random samples of my dataset. > "I hav

[R] glm-poisson fitting 400.000 records

2011-10-21 Thread D_Tomas
Hi, I am trying to fi a glm-poisson model to 400.000 records. I have tried biglm and glmulti but i have problems... can it really be the case that 400.000 are too many records??? I am thinking of using random samples of my dataset. Many thanks, -- View this message in context: http://r.78

Re: [R] GLM and Neg. Binomial models

2011-10-18 Thread D_Tomas
Dear Ben, First of all, many thanks for your reply. I am highly appreciative of that. I am still unsure about some issues The dispersion parameter is that which is estimated by sum(residuals(fit,type="pearson")^2)/fit$df.res. This is what a quasipoisson model estimates. This corresponds

Re: [R] GLM and Neg. Binomial models

2011-10-13 Thread Ben Bolker
D_Tomas hotmail.com> writes: > > Hi userRs! > > I am trying to fit some GLM-poisson and neg.binomial. The neg. Binomial > model is to account for over-dispersion. > > When I fit the poisson model i get: > (Dispersion parameter for poisson family taken to be 1) > > However, if I estimate the d

[R] GLM and Neg. Binomial models

2011-10-13 Thread D_Tomas
Hi userRs! I am trying to fit some GLM-poisson and neg.binomial. The neg. Binomial model is to account for over-dispersion. When I fit the poisson model i get: (Dispersion parameter for poisson family taken to be 1) However, if I estimate the dispersion coefficient by means of: sum(residuals(fi

[R] GLM Question

2011-09-09 Thread Jim Silverton
The minimum achievable level of significance is defined asthe minimum of Prob(Y=y) over all y's. If I have GLM with a treatment and replicate and I would like to find out how to compute the minimum achievable level of significance for that GLM in R For example, how do I do this for the following d

Re: [R] glm

2011-09-06 Thread Daniel Malter
y is the dependent variable, not a predictor or independent variable. since this is a binomial model, y should be 0/1 or, atypically, a proportion. HTH, Daniel Samuel Okoye wrote: > > Dear all, > > I am using glm with quasibinomial. What does the following error message > mean: > > Error in e

[R] glm

2011-09-05 Thread Samuel Okoye
Dear all, I am using glm with quasibinomial. What does the following error message mean: Error in eval(expr, envir, enclos) : y values must be 0 <= y <= 1 Does it mean that the predictor variable should only have zero and one or it is also possible to have continuous values between zero and one

Re: [R] GLM question

2011-08-23 Thread Andra Isan
to do the prediction for the hold-out data. Is there any better way for cross-validation to learn a model on training data and test it on test data in R? Thanks, Andra --- On Mon, 8/22/11, Joshua Wiley wrote: > From: Joshua Wiley > Subject: Re: [R] GLM question > To: "And

Re: [R] GLM question

2011-08-22 Thread Joshua Wiley
Hi Andra, There are several problems with what you are doing (by the way, I point them out so you can learn and improve, not to be harsh or rude). The good news is there is a solution (#3) that is easier than what you are doing right now! 1) glm.fit() is a function so it is a good idea not to us

[R] GLM question

2011-08-22 Thread Andra Isan
Hi All, I am trying to fit my data with glm model, my data is a matrix of size n*100. So, I have n rows and 100 columns and my vector y is of size n which contains the labels (0 or 1) My question is: instead of manually typing the model as glm.fit = glm(y~ x[,1]+x[,2]+...+x[,100], family=bino

Re: [R] GLM different results with the same factors

2011-07-29 Thread gaiarrido
Thanks very much again, I´m reading some papers and articles about this issue and I think i´m starting to understand the problem. And thanks for the link to Professor Fox about the non-sequential Anova. I'll be back with more doubts. I'm sure of that. - Mario Garrido Escudero PhD student Dpto

Re: [R] GLM different results with the same factors

2011-07-28 Thread Mark Difford
On Jul 27, 2011 gaiarrido wrote: > I've been reading these days about what you tell me, but i don't > understand properly. > How could I know, with this tests, which variables are significant?... Mario, You need to get in touch with a statistician at your university. You are fitting quite a comp

Re: [R] GLM different results with the same factors

2011-07-27 Thread gaiarrido
Ok, thanks, I've been reading these days about what you tell me, but i don't understand properly. How could I know, with this tests, which variables are significant? I know my dependent variable depends on the lcc and on the edadysexo. but only one per test seems to be significant. Thanks again -

Re: [R] GLM different results with the same factors

2011-07-24 Thread Mark Difford
On Jul 24, 2011 Gaiarrido wrote: > Why the order of the factors give different results? I suppose it's > because the order of the > factors, i've just changed "lcc" from the first position to the last in > the model, and the significance > change completely > ...snip < > Ijow can i know what's c

[R] GLM different results with the same factors

2011-07-24 Thread gaiarrido
I've read something about this problem, but I don't know how can i avoid this problem. Why the order of the factors give different results? I suppose it's because the order of the factors, i've just changed "lcc" from the first position to the last in the model, and the significance change complete

Re: [R] glm() scale parameters and predicted Values

2011-07-14 Thread Ben Bolker
Peter Maclean yahoo.com> writes: > > In glm() you can use the summary() function to recover > the shape parameter (the reciprocal of the > dispersion parameter). How do you recover the scale parameter? > Also, in the given example, how I estimate > and save the geometric mean of the predicted v

Re: [R] glm() scale parameters and predicted Values

2011-07-13 Thread Peter Maclean
In glm() you can use the summary() function to recover the shape parameter (the reciprocal of the dispersion parameter). How do you recover the scale parameter? Also, in the given example, how I estimate and save the geometric mean of the predicted values? For a simple model you can use fitted()

Re: [R] glm with binomial errors - problem with overdispersion

2011-06-14 Thread peter dalgaard
On Jun 14, 2011, at 09:53 , Anna Mill wrote: > > Also note that success+failure is exactly 102 in fragment 1 and 105 in > fragment 2, as is the sum of the successes for each fragment (of course it > has to to make exactly 1/4). It is rather easy to suspect that it is actually > a 0/1 coding o

Re: [R] glm with binomial errors - problem with overdispersion

2011-06-14 Thread Anna Mill
> Also note that success+failure is exactly 102 in fragment 1 and 105 in > fragment 2, as is the sum of the successes for each fragment (of course it > has to to make exactly 1/4). It is rather easy to suspect that it is > actually a 0/1 coding of the type (as in "tick exactly one box"), and not >

Re: [R] glm with binomial errors - problem with overdispersion

2011-06-14 Thread peter dalgaard
On Jun 14, 2011, at 08:13 , Prof Brian Ripley wrote: > I presume you intended 'type' and 'fragment' to be factors (see below). Such > a model would fit exactly. The additive model > >> model <- glm(y ~ fragment+type, binomial) > > is only modestly over-dispersed, and shows that 'fragment' ha

Re: [R] glm with binomial errors - problem with overdispersion

2011-06-13 Thread Anna Mill
thanks for the answer! yes, indeed, type and fragment should be factors but it was no artificial data! 2011/6/14 Prof Brian Ripley > I presume you intended 'type' and 'fragment' to be factors (see below). > Such a model would fit exactly. The additive model > > > model <- glm(y ~ fragment+typ

Re: [R] glm with binomial errors - problem with overdispersion

2011-06-13 Thread Prof Brian Ripley
I presume you intended 'type' and 'fragment' to be factors (see below). Such a model would fit exactly. The additive model model <- glm(y ~ fragment+type, binomial) is only modestly over-dispersed, and shows that 'fragment' has zero effect. Not 'a negligible effect', but no effect. So so

[R] glm with binomial errors - problem with overdispersion

2011-06-13 Thread Anna Mill
Dear all, I am new to R and my question may be trivial to you... I am doing a GLM with binomial errors to compare proportions of species in different categories of seed sizes (4 categories) between 2 sites. In the model summary the residual deviance is much higher than the degree of freedom (Resi

Re: [R] GLM output for deviance and loglikelihood

2011-04-21 Thread peter dalgaard
On Apr 21, 2011, at 11:30 , Jeffrey Pollock wrote: > So am I right in saying that Binary data isnt the only case where this is > true? It would make sense to me that for a multinomial model you could have a > unique factor for each data point and thus be able to create a likelihood of > 1. Ye

Re: [R] GLM output for deviance and loglikelihood

2011-04-21 Thread Jeffrey Pollock
algorithm until the coefficients where either 'Inf' or '-Inf'. Please let me know your thoughts on this. Thanks again, Jeff -Original Message- From: peter dalgaard [mailto:pda...@gmail.com] Sent: 21 April 2011 09:32 To: Juliet Hannah Cc: Jeffrey Pollock; r-help@r-p

Re: [R] GLM output for deviance and loglikelihood

2011-04-21 Thread peter dalgaard
On Apr 21, 2011, at 05:14 , Juliet Hannah wrote: > As you mentioned, the deviance does not always reduce to: > > D = -2(loglikelihood(model)) > > It does for ungrouped data, such as for binary logistic regression. To be precise, it only happens when the log likelihood of the saturated model i

Re: [R] GLM output for deviance and loglikelihood

2011-04-20 Thread Juliet Hannah
As you mentioned, the deviance does not always reduce to: D = -2(loglikelihood(model)) It does for ungrouped data, such as for binary logistic regression. So let's stick with the original definition. In this case, we need the log-likelihood for the saturated model. x = rnorm(10) y = rpois(10,l

Re: [R] GLM and normality of predictors

2011-04-15 Thread Ben Bolker
Sacha Viquerat web.de> writes: > > Am 15.04.2011 20:14, schrieb Christian Hennig: > > Normality of the predictors doesn't belong to the assumptions of the > > GLM, so you don't have to check this. > > > > On Fri, 15 Apr 2011, Simone Santoro wrote: > > > >> I want to estimate the possible effects

Re: [R] GLM and normality of predictors

2011-04-15 Thread Sacha Viquerat
Am 15.04.2011 20:14, schrieb Christian Hennig: Normality of the predictors doesn't belong to the assumptions of the GLM, so you don't have to check this. Note, however, that there are all kinds of potential problems which to detect is fairly hopeless with n=11 and three predictors, so you should

Re: [R] GLM and normality of predictors

2011-04-15 Thread Christian Hennig
Normality of the predictors doesn't belong to the assumptions of the GLM, so you don't have to check this. Note, however, that there are all kinds of potential problems which to detect is fairly hopeless with n=11 and three predictors, so you shouldn't be too confident about your results anywa

[R] GLM and normality of predictors

2011-04-15 Thread Simone Santoro
Hi, I have found quite a few posts on normality checking of response variables, but I am still in doubt about that. As it is easy to understand I'm not a statistician so be patient please. I want to estimate the possible effects of some predictors on my response variable that is nº of males an

[R] GLM output for deviance and loglikelihood

2011-04-15 Thread Jeffrey Pollock
It has always been my understanding that deviance for GLMs is defined by; D = -2(loglikelihood(model) - loglikelihood(saturated model)) and this can be calculated by (or at least usually is); D = -2(loglikelihood(model)) As is done so in the code for 'polr' by Brian Ripley (in the

Re: [R] glm with multiple vars

2011-04-11 Thread dirknbr
Sascha Thanks that works. Dirk -- View this message in context: http://r.789695.n4.nabble.com/glm-with-multiple-vars-tp3438095p3441476.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.eth

Re: [R] glm with multiple vars

2011-04-09 Thread Sascha Vieweg
On 11-04-09 10:34, dirknbr wrote: I am looping through various models with different combinations of independent variables which are stored as columns in x glm(y ~ ??, data=x) How can I pass the colnames of the selected columns of x into ?? seperating them with a + ie I want to generate glm(

[R] glm with multiple vars

2011-04-09 Thread dirknbr
I am looping through various models with different combinations of independent variables which are stored as columns in x glm(y ~ ??, data=x) How can I pass the colnames of the selected columns of x into ?? seperating them with a + ie I want to generate glm(y ~ x1 + x2, data=x) glm(y ~ x2 + x3,

Re: [R] glm predict on new data

2011-04-06 Thread Brian Diggs
On 4/6/2011 2:17 PM, dirknbr wrote: I am aware this has been asked before but I could not find a resolution. I am doing a logit lg<- glm(y[1:200] ~ x[1:200,1],family=binomial) glm (and most modeling functions) are designed to work with data frames, not raw vectors. Then I want to predict

Re: [R] glm predict on new data

2011-04-06 Thread Tóth Dénes
Dear Dirk, You should avoid indexing in the glm call so that the name of the terms will not contain the indexing part. (Check str(lg) in your example.) A more preferred solution uses predefined data frames in the original calls: n <- 250 x <- rnorm(n) noise <- rnorm(n,0,0.3) y <- round(exp(x+nois

[R] glm predict on new data

2011-04-06 Thread dirknbr
I am aware this has been asked before but I could not find a resolution. I am doing a logit lg <- glm(y[1:200] ~ x[1:200,1],family=binomial) Then I want to predict a new set pred <- predict(lg,x[201:250,1],type="response") But I get varying error messages or warnings about the different number

Re: [R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread Mikhail Spivakov
Update: turns out there was a sister posting to mine two years ago: http://r.789695.n4.nabble.com/Zinb-for-Non-interger-data-td898206.html It was then suggested to use a zero-inflated distribution from the gamlss package. It turns out that they do have a zero-adjusted (albeit not strictly speakin

Re: [R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread Mark Difford
On Mar 30, 2011; 11:41am Mikhail wrote: >> I'm wondering if there's any way to do the same in R (lme can't deal >> with this, as far as I'm aware). You can do this using the pscl package. Regards, Mark. -- View this message in context: http://r.789695.n4.nabble.com/glm-modelling-zeros-as-bina

Re: [R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread Mikhail Spivakov
Hi Dennis, Thanks - these were the first things I tried, but the problem is that they refuse to work with non-count data... Mikhail On Wed, Mar 30, 2011 at 12:56 PM, Dennis Murphy wrote: > Hi: > > You might want to consider hurdle models in the pscl package. > > HTH, > Dennis > > On Wed, Mar 30,

Re: [R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread Dennis Murphy
Hi: You might want to consider hurdle models in the pscl package. HTH, Dennis On Wed, Mar 30, 2011 at 2:41 AM, a11msp wrote: > Hello, > > I'd like to implement a regression model for extremely zero-inflated > continuous data using a conditional approach, whereby zeroes are > modelled as coming

[R] glm: modelling zeros as binary and non-zeroes as coming from a continuous distribution

2011-03-30 Thread a11msp
Hello, I'd like to implement a regression model for extremely zero-inflated continuous data using a conditional approach, whereby zeroes are modelled as coming from a binary distribution, while non-zero values are modelled as log-normal. So far, I've come across two solutions for this: one, in R,

[R] glm with within-subject factors

2011-03-28 Thread Jonathan Flowers
Hello, I am analyzing a dataset where the response is count data. I have one two-level factor that is repeated within-subjects and additional between-subject variables that are either categorical or continuous. I have previously modeled a comparable dataset (without the within-subjects factor) u

[R] glm: calculating average marginal effects for dummies

2011-03-28 Thread E Hofstadler
Dear list, My question to follow is not a pure R question but contains also a more general statistical/econometrical part, but I was hoping that perhaps someone knowledgable on this list could offer some help. I have estimated a binary logistic regression model and would like to calculate average

Re: [R] GLM / Logistic Regression Problem

2011-03-02 Thread Bert Gunter
Please read the Help for predict.glm carefully to make sure you are not confusing predicted response on the linear scale (log odds) with that on the probability scale. The warning is just that: a warning. It means that you have fitted PROBABILITIES on the boundary, which might compromise the itera

[R] GLM / Logistic Regression Problem

2011-03-02 Thread patsko
Hi there, I am encountering a problem with the GLM tool performing logistic regression. After computing a warning appears, saying “glm.fit: fitted probabilities numerically 0 or 1 occurred”. A prediction of new values confirms the problem as the model does not produce regular probability estima

Re: [R] GLM, how to get an R2 to explain how much of data explained by one variable

2011-02-25 Thread Clare Embling
Hi Celine, GLM outputs usually give the null deviance and residual deviance in the summary() term - so you can work out % deviance explained for a variable/model from this. Hope this helps. Best wishes, Clare Dr Clare B Embling Visiting Research Fellow Marine Inst

[R] GLM, how to get an R2 to explain how much of data explained by one variable?

2011-02-23 Thread Céline Geiser
__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

[R] GLM Empirical Likelihood

2011-01-27 Thread Antonio Paredes
Hello, I wanted to ask if there is an R package to fit GLM (logistic for example) via empirical likelihood. -- -Tony [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE

Re: [R] glm specification where response is a 2col matrix

2011-01-11 Thread Prof Brian Ripley
Your first model is a binomial glm witb 4 observations of 6,6,4,4 trials. Your second model is a Bernoulli glm with 20 observations of one trial each. The saturated models are different, as are the likelihoods (unsurprising given the data is different): the binomial model has comnbinarial f

[R] glm specification where response is a 2col matrix

2011-01-11 Thread Uwe Ligges
Hi, when I apply a glm() model in two ways, first with the response in a two column matrix specification with successes and failures y <- matrix(c( 5, 1, 3, 3, 2, 2, 0, 4), ncol=2, byrow=TRUE) X <- data.frame(x1 = factor(c(1,1,0,0)), x2 = factor(c(0,1,0,1))) g

<    1   2   3   4   >