Still getting error in "mloglhelper()... invalid data: family = 3" even after following solution

151 views
Skip to first unread message

M Abdur-Razak

unread,
Aug 22, 2017, 12:53:53 PM8/22/17
to Aster Analysis User Group
This is the same problem outlined in this post here. I followed the second solution as I agree that it is better for my data.

Like many of you, I am a biologist, but perhaps unlike many of you, I am terrible at R. I am steadily learning, but just as a warning, my R coding may baffle some of you. (on that note, if you have any helpful tips for me, I always appreciate learning something new) 


In JSG's solution above, they provide an ifelse() code to create a 'between level' variable. My variables are frt_set (whether a flower has matured into a fruit or not) and seedv (a seed count of all viable seeds). The between variable in my case, then, would be seed_set, which is only equal to 1 when frt_set ==1. I'm not sure how this allows for us to now use zero-truncated poisson, because there are still 0's in seedv. So in line 74 of my code, I add seedv+1. 

However, as I follow through with the Aster protocol, I still get the error output: Error in mloglhelper(parm, pred, fam, x, root, modmat, origin, deriv = 0,  : 
  invalid data: family = 3, x = 1.000000, xpred = 0.000000

Note that x and xpred are switched in my error output than in the thread linked above. 

Am I still doing something wrong?

geyer

unread,
Aug 27, 2017, 4:43:35 PM8/27/17
to Aster Analysis User Group
Your R file is not reproducible.  We obviously have no idea what you think we are supposed to do when the fix command is executed.  You have to replace this with R code that does what you want without user input.

From reading your posting  it is unclear what you are trying to do but seedv + 1 sounds very suspicious (even though I don't even know what seedv is).

If you have a variable z that you want to have a zero-inflated Poisson distribution conditional on some other variable x, then the aster way to achieve this
is to introduce another variable y defined as

    y <- as.numeric(z > 0)

and have your graph be ... x -> y -> z ... (putting y between z and x).  The interpretation is that y is the indicator of whether z in nonzero.  There isn't any adding one. The course notes for the special topics course on aster models starting here http://www.stat.umn.edu/geyer/8931aster/slides/s1.pdf#page=25 explain.

geyer

unread,
Aug 27, 2017, 4:55:35 PM8/27/17
to Aster Analysis User Group
Perhaps I posted without sufficient thought.  On rereading what you posted it seems your graph is

    ... ---> frt_set ---> seed_set ---> seedv ---> ...

In this case we should define

    seed_set <- as.numeric(seedv > 0)

Note that you do have zeros in seedv.  You have seedv == 0 if and only if its predecessor (seed_set) is zero.  And that's the way zero-truncated Poisson works. ANY variable having ANY distribution is zero whenever its predecessor is zero.  A zero-truncated variable is zero if and only if its predecessor is zero.

Note that we may have seed_set == 0 even when frt_set > 0, but we must have seed_set == 0 whenever frt_set == 0.
Reply all
Reply to author
Forward
0 new messages