Hello, I am trying to run a generalized linear model but do not know where to begin. I have attached my data to R but do not know where to go from there. I have two independent variables (each has two factors associated with them) and two dependent variables, each with either a yes/no response which I've valued either 0 or 1 in the data set. Any input would be greatly appreciated. -- View this message in context: http://r.789695.n4.nabble.com/Generalized-Linear-Model-tp3473924p3473924.html Sent from the R help mailing list archive at Nabble.com.
Am 25.04.2011 21:28, schrieb Megan:> Hello, > > I am trying to run a generalized linear model but do not know where to > begin. I have attached my data to R but do not know where to go from there. > I have two independent variables (each has two factors associated with them)What do you mean by this? You have two input variables, who are binary, meaning yes/no (or male/female, high/low, ...) variables?> and two dependent variables, each with either a yes/no response which I've > valued either 0 or 1 in the data set. Any input would be greatly > appreciated.If your dependent variable is binary, you might want to google for "logistic regression" (this belongs to generalized linear models). The R-function who handles this is glm(), with the parameter family=binomial(). Have fun, Alex
Hi! Try to read about the glm function, type: ?glm in your R editor. It looks like you have contingency tables, maybe a loglin model would be good to start with. D 2011-04-25 12:28 keltez?ssel, Megan ?rta:> Hello, > > I am trying to run a generalized linear model but do not know where to > begin. I have attached my data to R but do not know where to go from there. > I have two independent variables (each has two factors associated with them) > and two dependent variables, each with either a yes/no response which I've > valued either 0 or 1 in the data set. Any input would be greatly > appreciated. > > -- > View this message in context: http://r.789695.n4.nabble.com/Generalized-Linear-Model-tp3473924p3473924.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. > >
Because you have two dependent variables, you'll want to to use a multivariate logit. mlogit does this, but I don't know the syntax off hand. If you just wanted to look at one dependent variable, it would be the following (which Alex said) glm(y~x1*x2,family='binomial') On Mon, Apr 25, 2011 at 3:28 PM, Megan <aforkonaplate at hotmail.com> wrote:> > Hello, > > I am trying to run a generalized linear model but do not know where to > begin. I have attached my data to R but do not know where to go from there. > I have two independent variables (each has two factors associated with them) > and two dependent variables, each with either a yes/no response which I've > valued either 0 or 1 in the data set. Any input would be greatly > appreciated. > > -- > View this message in context: http://r.789695.n4.nabble.com/Generalized-Linear-Model-tp3473924p3473924.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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.
Seemingly Similar Threads
- indicator or deviation contrasts in log-linear modelling
- gap.boxplot error message?
- general linear model and generalized linear model
- loading lme4 fails - "function 'cholmod_l_start' not provided by package 'Matrix'"
- Tick marks that correspond with bars on barplot