Dear Oscar, and any other R-project person, Can you please help me to figure out the meaning of the following error message in red ? Error in eval(predvars, data, env) : numeric 'envir' arg not of length one I computed ordered logit models using 'polr' in R (I just followed the guidance a handout I found on princeton.edu about logit, probit and multinomial logit models) . The summary results are obtained without any problem. *However*, when I'm using the package 'erer' to compute the marginal effects for the ordered logit models, I'm just getting the error message above. Please HELP !!!! Willy -- Willy Mulimbi B. AEAB Grad Student & Fulbright Scholar Tel. (+1) 479-316-5981 Fayetteville, AR [[alternative HTML version deleted]]

You are more likely to get a useful answer if you read **and follow** the posting guide linked below. In particular, show us the code that elicited the error. A small reproducible example would be even better, though may not be needed. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Mon, Mar 19, 2018 at 2:24 PM, Willy Byamungu <wmulimbi at email.uark.edu> wrote:> Dear Oscar, > and any other R-project person, > > Can you please help me to figure out the meaning of the following error > message in red ? > > Error in eval(predvars, data, env) : > numeric 'envir' arg not of length one > > I computed ordered logit models using 'polr' in R (I just followed the > guidance a handout I found on princeton.edu about logit, probit and > multinomial logit models) . The summary results are obtained without any > problem. *However*, when I'm using the package 'erer' to compute the > marginal effects for the ordered logit models, I'm just getting the error > message above. > > Please HELP !!!! > > Willy > > > -- > Willy Mulimbi B. > AEAB Grad Student & Fulbright Scholar > Tel. (+1) 479-316-5981 > Fayetteville, AR > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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. >[[alternative HTML version deleted]]

Hi Willy, The error message may be due to passing an inappropriate environment. I don't have the "erer" package, but if that function has a default for the environment argument, perhaps passing just the "predvars" and "data" arguments will work. Jim On Tue, Mar 20, 2018 at 8:24 AM, Willy Byamungu <wmulimbi at email.uark.edu> wrote:> Dear Oscar, > and any other R-project person, > > Can you please help me to figure out the meaning of the following error > message in red ? > > Error in eval(predvars, data, env) : > numeric 'envir' arg not of length one > > I computed ordered logit models using 'polr' in R (I just followed the > guidance a handout I found on princeton.edu about logit, probit and > multinomial logit models) . The summary results are obtained without any > problem. *However*, when I'm using the package 'erer' to compute the > marginal effects for the ordered logit models, I'm just getting the error > message above. > > Please HELP !!!! > > Willy > > > -- > Willy Mulimbi B. > AEAB Grad Student & Fulbright Scholar > Tel. (+1) 479-316-5981 > Fayetteville, AR > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > 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.

In that case, I can't work out why the first model fails but not the second. I would start looking at "Data" to see what it contains. if: object2 <- polr(Inc ~ Training ,Data,Hess = T,method = "logistic" ) works, the problem may be with the "Adopt" variable. Jim On Tue, Mar 20, 2018 at 10:55 AM, Willy Byamungu <wmulimbi at email.uark.edu> wrote:> Sorry, do not read "Inc_reliable_fromNTA" I did a mistake in the email I > sent you. It should be just "Inc". > > The situation looks like this > > Data$Inc <- ordered(Data$Inc > c("Not_reliable_at_all","Less_reliable","Somehow_reliable","Very reliable")) > > First model > object1 <- polr(Inc ~ Adopt ,Data,Hess = T,method = "logistic") > > Marginal effect for object1: > ocME(object1) > Error in eval(predvars, data, env) : > numeric 'envir' arg not of length one > > Second model > object2 <- polr(Inc ~ Adopt + Training ,Data,Hess = T,method = "logistic" ) > > Marginal effect for object2: > ocME(object2) > effect.Not_reliable_at_all effect.Less_reliable effect.Somehow_reliable > effect.Very reliable > Adopt -0.073 -0.057 > -0.064 0.193 > Training -0.283 -0.135 > -0.051 0.469 > > > On Mon, Mar 19, 2018 at 6:46 PM, Jim Lemon <drjimlemon at gmail.com> wrote: >> >> Hi Willy, >> I had a look at the "erer" manual, and it looks like a (somewhat) >> misleading error message. I don't know where "Inc_reliable_fromNTA" >> may be, but it looks like the ocME function can't find it, which leads >> to the "environment" error message. You have defined "Inc" as an >> element of "Data" and when that is used in the model, the ocME >> function works. I suspect that "Inc_reliable_fromNTA" is not an >> element of "Data" and this is why ocME cannot find it. >> >> Jim >> >> >> On Tue, Mar 20, 2018 at 10:26 AM, Willy Byamungu >> <wmulimbi at email.uark.edu> wrote: >> > Dear Jim, >> > >> > Thank you very much for your help. >> > >> > My R-coding looks like this: >> > >> > Data$Inc <- ordered(Data$Inc >> > c("Not_reliable_at_all","Less_reliable","Somehow_reliable","Very >> > reliable")) >> > >> > First model >> > object1 <- polr(Inc_reliable_fromNTA ~ Adopt ,Data,Hess = T,method >> > "logistic") >> > >> > Marginal effect for object1: >> > ocME(object1) >> > Error in eval(predvars, data, env) : >> > numeric 'envir' arg not of length one >> > >> > Second model >> > object2 <- polr(Inc ~ Adopt + Training ,Data,Hess = T,method >> > "logistic" ) >> > >> > Marginal effect for object2: >> > ocME(object2) >> > effect.Not_reliable_at_all effect.Less_reliable effect.Somehow_reliable >> > effect.Very reliable >> > Adopt -0.073 -0.057 >> > -0.064 0.193 >> > Training -0.283 -0.135 >> > -0.051 0.469 >> >> >> > >> > The model computing requires package "MASS" and marginal effects require >> > "ERER". As you can see above, in the first case it succeed to provide >> > results but in the first case NO. >> > >> > What do you think? By the way, what do you mean by inappropriate >> > environment >> > and predvars? >> > >> > Looking forward to hearing from you. >> > >> > Regards, >> > >> > Willy >> > >> > On Mon, Mar 19, 2018 at 5:33 PM, Jim Lemon <drjimlemon at gmail.com> wrote: >> >> >> >> Hi Willy, >> >> The error message may be due to passing an inappropriate environment. >> >> I don't have the "erer" package, but if that function has a default >> >> for the environment argument, perhaps passing just the "predvars" and >> >> "data" arguments will work. >> >> >> >> Jim >> >> >> >> On Tue, Mar 20, 2018 at 8:24 AM, Willy Byamungu >> >> <wmulimbi at email.uark.edu> >> >> wrote: >> >> > Dear Oscar, >> >> > and any other R-project person, >> >> > >> >> > Can you please help me to figure out the meaning of the following >> >> > error >> >> > message in red ? >> >> > >> >> > Error in eval(predvars, data, env) : >> >> > numeric 'envir' arg not of length one >> >> > >> >> > I computed ordered logit models using 'polr' in R (I just followed >> >> > the >> >> > guidance a handout I found on princeton.edu about logit, probit and >> >> > multinomial logit models) . The summary results are obtained without >> >> > any >> >> > problem. *However*, when I'm using the package 'erer' to compute the >> >> > marginal effects for the ordered logit models, I'm just getting the >> >> > error >> >> > message above. >> >> > >> >> > Please HELP !!!! >> >> > >> >> > Willy >> >> > >> >> > >> >> > -- >> >> > Willy Mulimbi B. >> >> > AEAB Grad Student & Fulbright Scholar >> >> > Tel. (+1) 479-316-5981 >> >> > Fayetteville, AR >> >> > >> >> > [[alternative HTML version deleted]] >> >> > >> >> > ______________________________________________ >> >> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see >> >> > 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. >> > >> > >> > >> > >> > -- >> > Willy Mulimbi B. >> > AEAB Grad Student & Fulbright Scholar >> > Tel. (+1) 479-316-5981 >> > Fayetteville, AR > > > > > -- > Willy Mulimbi B. > AEAB Grad Student & Fulbright Scholar > Tel. (+1) 479-316-5981 > Fayetteville, AR

Thank you very much Jim. On Mon, Mar 19, 2018, 7:20 PM Jim Lemon <drjimlemon at gmail.com> wrote:> In that case, I can't work out why the first model fails but not the > second. I would start looking at "Data" to see what it contains. if: > > object2 <- polr(Inc ~ Training ,Data,Hess = T,method = "logistic" ) > > works, the problem may be with the "Adopt" variable. > > Jim > > > On Tue, Mar 20, 2018 at 10:55 AM, Willy Byamungu > <wmulimbi at email.uark.edu> wrote: > > Sorry, do not read "Inc_reliable_fromNTA" I did a mistake in the email I > > sent you. It should be just "Inc". > > > > The situation looks like this > > > > Data$Inc <- ordered(Data$Inc > > c("Not_reliable_at_all","Less_reliable","Somehow_reliable","Very > reliable")) > > > > First model > > object1 <- polr(Inc ~ Adopt ,Data,Hess = T,method = "logistic") > > > > Marginal effect for object1: > > ocME(object1) > > Error in eval(predvars, data, env) : > > numeric 'envir' arg not of length one > > > > Second model > > object2 <- polr(Inc ~ Adopt + Training ,Data,Hess = T,method > "logistic" ) > > > > Marginal effect for object2: > > ocME(object2) > > effect.Not_reliable_at_all effect.Less_reliable effect.Somehow_reliable > > effect.Very reliable > > Adopt -0.073 -0.057 > > -0.064 0.193 > > Training -0.283 -0.135 > > -0.051 0.469 > > > > > > On Mon, Mar 19, 2018 at 6:46 PM, Jim Lemon <drjimlemon at gmail.com> wrote: > >> > >> Hi Willy, > >> I had a look at the "erer" manual, and it looks like a (somewhat) > >> misleading error message. I don't know where "Inc_reliable_fromNTA" > >> may be, but it looks like the ocME function can't find it, which leads > >> to the "environment" error message. You have defined "Inc" as an > >> element of "Data" and when that is used in the model, the ocME > >> function works. I suspect that "Inc_reliable_fromNTA" is not an > >> element of "Data" and this is why ocME cannot find it. > >> > >> Jim > >> > >> > >> On Tue, Mar 20, 2018 at 10:26 AM, Willy Byamungu > >> <wmulimbi at email.uark.edu> wrote: > >> > Dear Jim, > >> > > >> > Thank you very much for your help. > >> > > >> > My R-coding looks like this: > >> > > >> > Data$Inc <- ordered(Data$Inc > >> > c("Not_reliable_at_all","Less_reliable","Somehow_reliable","Very > >> > reliable")) > >> > > >> > First model > >> > object1 <- polr(Inc_reliable_fromNTA ~ Adopt ,Data,Hess = T,method > >> > "logistic") > >> > > >> > Marginal effect for object1: > >> > ocME(object1) > >> > Error in eval(predvars, data, env) : > >> > numeric 'envir' arg not of length one > >> > > >> > Second model > >> > object2 <- polr(Inc ~ Adopt + Training ,Data,Hess = T,method > >> > "logistic" ) > >> > > >> > Marginal effect for object2: > >> > ocME(object2) > >> > effect.Not_reliable_at_all effect.Less_reliable > effect.Somehow_reliable > >> > effect.Very reliable > >> > Adopt -0.073 -0.057 > >> > -0.064 0.193 > >> > Training -0.283 -0.135 > >> > -0.051 0.469 > >> >> > >> > > >> > The model computing requires package "MASS" and marginal effects > require > >> > "ERER". As you can see above, in the first case it succeed to provide > >> > results but in the first case NO. > >> > > >> > What do you think? By the way, what do you mean by inappropriate > >> > environment > >> > and predvars? > >> > > >> > Looking forward to hearing from you. > >> > > >> > Regards, > >> > > >> > Willy > >> > > >> > On Mon, Mar 19, 2018 at 5:33 PM, Jim Lemon <drjimlemon at gmail.com> > wrote: > >> >> > >> >> Hi Willy, > >> >> The error message may be due to passing an inappropriate environment. > >> >> I don't have the "erer" package, but if that function has a default > >> >> for the environment argument, perhaps passing just the "predvars" and > >> >> "data" arguments will work. > >> >> > >> >> Jim > >> >> > >> >> On Tue, Mar 20, 2018 at 8:24 AM, Willy Byamungu > >> >> <wmulimbi at email.uark.edu> > >> >> wrote: > >> >> > Dear Oscar, > >> >> > and any other R-project person, > >> >> > > >> >> > Can you please help me to figure out the meaning of the following > >> >> > error > >> >> > message in red ? > >> >> > > >> >> > Error in eval(predvars, data, env) : > >> >> > numeric 'envir' arg not of length one > >> >> > > >> >> > I computed ordered logit models using 'polr' in R (I just followed > >> >> > the > >> >> > guidance a handout I found on princeton.edu about logit, probit > and > >> >> > multinomial logit models) . The summary results are obtained > without > >> >> > any > >> >> > problem. *However*, when I'm using the package 'erer' to compute > the > >> >> > marginal effects for the ordered logit models, I'm just getting the > >> >> > error > >> >> > message above. > >> >> > > >> >> > Please HELP !!!! > >> >> > > >> >> > Willy > >> >> > > >> >> > > >> >> > -- > >> >> > Willy Mulimbi B. > >> >> > AEAB Grad Student & Fulbright Scholar > >> >> > Tel. (+1) 479-316-5981 > >> >> > Fayetteville, AR > >> >> > > >> >> > [[alternative HTML version deleted]] > >> >> > > >> >> > ______________________________________________ > >> >> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see > >> >> > 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. > >> > > >> > > >> > > >> > > >> > -- > >> > Willy Mulimbi B. > >> > AEAB Grad Student & Fulbright Scholar > >> > Tel. (+1) 479-316-5981 > >> > Fayetteville, AR > > > > > > > > > > -- > > Willy Mulimbi B. > > AEAB Grad Student & Fulbright Scholar > > Tel. (+1) 479-316-5981 > > Fayetteville, AR >[[alternative HTML version deleted]]