Displaying 20 results from an estimated 40000 matches similar to: "lm and glm"
2012 Oct 29
1
change lm log(x) to glm poisson
Hello list,
I am running a regression using
lm(Y~A+B+log(C)+log(D))
Now, I would like to test if glm can produce similar results.
So the code was revised as
glm(Y~A+B+C+D, family=poisson) (code 1)
However, I found some example using glm for lm.
It suggests that the code should be revised like
glm(Y~A+B+log(C)+log(D), family=poisson) (code 2)
Please kindly advise which code is correct.
2008 Aug 26
1
A Tip: lm, glm, and retained cases
Hi Folks,
This tip is probably lurking somewhere already, but I've just
discovered it the hard way, so it is probably worth passing
on for the benefit of those who might otherwise hack their
way along the same path.
Say (for example) you want to do a logistic regression of a
binary response Y on variables X1, X2, X3, X4:
GLM <- glm(Y ~ X1 + X2 + X3 + X4)
Say there are 1000 cases in the
2010 Aug 17
2
Independent variables omitted in lm and glm
Dear List,
Some independent variable were missing in calculation using lm and glm
(gaussian).
(X= Y1+Y2+…..+Y16, Independent number: 16 variable)
However, those variables did work well in cor(X, Y) respectively.
str(dataframe) was also run to ensure that the variables were all numbers.
Moreover, the missing variables were different in lm and glm.
In lm, 3 factors were not taken into
2008 May 20
0
recompute values repeatedly, or new file for glm()?
Hello all,
I need to tap into the collective wisdom of the group re an issue of
efficiency.
A sketch of the situation:
Let's say 4000 observations in variables Y, X1, X2 , X3 and X4.
I would like to feed various combinations of this expression
Y ~ X1+X2+X3+X4 + I(X1^2)+I(X2^2)+I(X3^2)+I(X4^2) + X1*X2 + X1*X3 + X1*X4 +
X2*X3 + X2*X4 + X3*X4
repeatedly to glm(). (I really have little
2010 Oct 12
1
delta AIC for models with 2 variables using MuMIn
Dear List,
I want to ask a AIC question based on package library(MuMIn)
The relative importance of 16 explanatory variables
are assessed using delta AIC in a generalized linear model.
Please kindly advise if it is possible to show models
with any two only certain variables.
Thank you.
Elaine
I asked a similar question and got a great help for models
with only one variable as below.
2010 Jun 20
2
compute coefficient of determination (R-squared) for GLM (maximum likelihood)
Dear,
I want to compute coefficient of determination (R-squared) to complement AIC
for model selection of
multivariable GLM.
However, I found this is not a built-in function in glm. neither is it
available through reviewing the question in the R-help archive.
Please kindly help and thanks a lot.
Elaine
[[alternative HTML version deleted]]
2008 May 13
1
Missing coefficient on a glm object
Hello guys, i looked over the archive files and found nothing about this
kind of error.
I have a database of 33 elements described in 8 variables, i'm using the
Leave-One-Out iterative process
to take one of the elements to be the test element and make a regression
with the other 32 and then
I try to predict the clas of the element out.
I'm using this call as a part of a Leave-One-Out
2013 Apr 13
1
how to add a row vector in a dataframe
Hi,
Using S=1000
and
simdata <- replicate(S, generate(3000))
#If you want both "m1" and "m0" #here the missing values are 0
res1<-sapply(seq_len(ncol(simdata.psm1)),function(i) {x1<-merge(simdata.psm0[,i],simdata.psm1[,i],all=TRUE); x1[is.na(x1)]<-0; x1})
res1[,997:1000]
#????? [,1]???????? [,2]???????? [,3]???????? [,4]???????
#x1??? Numeric,3000 Numeric,3000
2008 Jan 07
0
R vglm new family writing: mix Poisson/multinomial
Hi dear R users,
1)
I would like to know if there is a simple way to define a vglm family which
would be a mix of poisson variables and bernoulli variables (0/1 response)
for idea this would be invoked like this:
vglm(...,family=mixpoissonmultinom(npoisson,n01response))
where the n's give the number of each type of response.
2)
and a simpler question : How to use constraints in rrvglm?
2011 Aug 20
2
a Question regarding glm for linear regression
Hello All,
I have a question about glm in R. I would like to fit a model with glm function, I have a vector y (size n) which is my response variable and I have matrix X which is by size (n*f) where f is the number of features or columns. I have about 80 features, and when I fit a model using the following formula,?
glmfit = glm(y ~ x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10 + x11 + x12 + x13
2011 Apr 09
2
glm with multiple vars
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, data=x)
glm(y ~ x1 + x2 + x4, data=x)
...
I have tried the sedit function
2013 Jun 20
0
New book: Beginner's Guide to GLM and GLMM with R
Members of this mailing list may be interested in the following new book:
Beginner's Guide to GLM and GLMM with R.
- A frequentist and Bayesian perspective for ecologists -
Zuur AF, Hilbe JM and Ieno EN
This book is only available from:
http://www.highstat.com/BGGLM.htm
This book presents Generalized Linear Models (GLM) and Generalized
Linear Mixed Models (GLMM) based on both
2004 Oct 15
0
constrained splines in GLM
Hi,
I would like to use constrained splines in a GLM model (Poisson link)
to take into account the nonlinear effect of some covariate. The
constraints I need are described below.
I have several variables that I need concurrently in the same model.
I looked at package mgcv but I do not know if/how I can use it in GLM (not
GAM) : I could
not manage to adapt the mono.con(mgcv) example to GLM.
The
2018 Jan 17
1
Assessing calibration of Cox model with time-dependent coefficients
I am trying to find methods for testing and visualizing calibration to Cox
models with time-depended coefficients. I have read this nice article
<http://journals.sagepub.com/doi/10.1177/0962280213497434>. In this paper,
we can fit three models:
fit0 <- coxph(Surv(futime, status) ~ x1 + x2 + x3, data = data0) p <-
log(predict(fit0, newdata = data1, type = "expected")) lp
2010 Aug 17
2
AIC in MuMIn
Hello,
I am using package MuMIn to calculate AIC for a full model with 10
explanatory variables.
Thanks in advance in sharing your experience.
Q1
In the AIC list of all models, each model is differentiated by model number.
Please kindly advise if it is possible to
find the corresponding explanatory variable(s) for the model number.
Q2 error message
I tried to display sub-model with only
2008 Mar 12
1
[follow-up] "Longitudinal" with binary covariates and outcome
Hi again!
Following up my previous posting below (to which no response
as yet), I have located a report which situates this type
of question in a longitudinal modelling context.
http://www4.stat.ncsu.edu/~dzhang2/paper/glm.ps
Generalized Linear Models with Longitudinal Covariates
Daowen Zhang & Xihong Lin
(This work seems to originally date from around 1999).
They consider an outcome Y,
2003 Aug 04
1
Error in calling stepAIC() from within a function
Hi,
I am experiencing a baffling behaviour of stepAIC(),
and I hope to get any advice/help on what went wrong
or I'd missed. I greatly appreciate any advice given.
I am using stepAIC() to, say, select a model via
stepwise selection method.
R Version : 1.7.1
Windows ME
Many thanks and best regards,
Siew-Leng
***Issue :
When stepAIC() is placed within a function, it seems
2018 Jan 18
1
Time-dependent coefficients in a Cox model with categorical variants
First, as others have said please obey the mailing list rules and turn of
First, as others have said please obey the mailing list rules and turn off html, not everyone uses an html email client.
Here is your code, formatted and with line numbers added. I also fixed one error: "y" should be "status".
1. fit0 <- coxph(Surv(futime, status) ~ x1 + x2 + x3, data = data0)
2. p
2008 Dec 19
1
svyglm and sandwich estimator of variance
Hi,
I would like to estimate coefficients using poisson regression and then get
standard errors that are adjusted for heteroskedasticity, using a complex
sample survey data. Then I will calculate prevalence ratio and confidence
intervals.
Can sandwich estimator of variance be used when observations aren?t
independent? In my case, observations are independent across groups
(clusters), but
2003 Jul 30
0
stepAIC()
Hi,
I am experiencing a baffling behaviour of stepAIC(),
and I hope to get any advice/help on this. Greatly
appreciate any kind advice given.
I am using stepAIC() to, say, select a model via
stepwise selection method.
R Version : 1.7.1
Windows ME
Many thanks!
***Issue :
When stepAIC() is placed within a function, it seems
that stepAIC() cannot detect the data matrix, and the
program is