Message Boards Message Boards

0
|
2219 Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Problems regarding syntax of GeneralizedLinearModelFit

Posted 9 years ago

Why am I unable to get my glm model from the following input:(using Mathematica 5) Note: There is one response variable and three dependent variable.

GeneralizedLinearModelFit[{1, 8, 25, 13, 5, 4, 1, 1,
   2, 2, 3, 3, 1, 4, 3, 4, 5, 5, 0, 4, 0, 3, 2, 1}, {3418, 5213, 4882, 4994, 
    4359, 4360, 4159, 4568, 3232, 4168, 4232, 3987, 4760, 6692, 4703, 
    3980, 5187,
   4430, 1135, 2007, 1736, 1792, 1759, 1618}, {1121, 1546, 1846, 1826, 1519,
     1538, 1158, 1334, 1433, 982, 1278, 995, 214, 332, 545, 581, 396, 526, 
    175, 351, 262, 293, 287, 322}, {0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, x, x, x, ExponentialFamily -> Poisson]
POSTED BY: Sara Sanzana
2 Replies

What error message or behavior do you see when you run your code?

Does Mathematica 5 have GeneralizedLinearModelFit as a function? The function GeneralizedLinearModelFit was introduced in Mathematica 7.

POSTED BY: Sean Clarke

Hi Sara,

I am not sure whether this helps, because I cannot check what Mathematica 5 does. I am running version 10.0.2. The syntax of your command is incorrect, but I would require more information to fix it. There are several problems with the function. For example the Poisson for the exponential family needs to go in quotation marks. Also it appears that the input data is in the wrong format. I am not sure which variable is supposed to be explained by which other variables.

One way of making it work is:

GeneralizedLinearModelFit[
 Transpose[{{1, 8, 25, 13, 5, 4, 1, 1, 2, 2, 3, 3, 1, 4, 3, 4, 5, 5, 
    0, 4, 0, 3, 2, 1}, {3418, 5213, 4882, 4994, 4359, 4360, 4159, 
    4568, 3232, 4168, 4232, 3987, 4760, 6692, 4703, 3980, 5187, 4430, 
    1135, 2007, 1736, 1792, 1759, 1618}, {1121, 1546, 1846, 1826, 
    1519, 1538, 1158, 1334, 1433, 982, 1278, 995, 214, 332, 545, 581, 
    396, 526, 175, 351, 262, 293, 287, 322}, {0, 0, 1, 1, 0, 0, 0, 0, 
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}}], {x, y, z}, {x, 
  y, z}, ExponentialFamily -> "Poisson"]

I would need to know more about what means what in this example to give a reasonable answer.

Best wishes, Marco

POSTED BY: Marco Thiel
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract