Hi all, The problem is that when you try to use the function summary of a polr object in a function, it does not work. The problem is not related to the formula or the structure of data involved. It is probably related to the use of the function "vcov" in the code of summary for polr, and the iterative procedure to estimate the Hessian.
Anyway, here there is an example extracted from polr help in MASS: The function could be: temp <- function(form, dat) { house.plr <- polr(formula = form, weights = Freq, data = dat) summ <- summary(house.plr) return(summ)} the function can be called by: temp(Sat ~ Infl + Type + Cont, housing) where all data is available from MASS, as it is an example in R Help on 'polr'. Results are: Re-fitting to get Hessian Error in eval(expr, envir, enclos) : object "dat" not found Paolo Accadia >>> Michael Dewey <[EMAIL PROTECTED]> 20/02/07 13.43 >>> At 15:21 19/02/2007, Paolo Accadia wrote: >Hi all, > >I have a problem to estimate Std. Error and >t-value by “polr†in library Mass. >They result from the summary of a polr object. > >I can obtain them working in the R environment with the following statements: > > temp <- polr(formula = formula1, data = data1) > coeff <- summary(temp), > >but when the above statements are enclosed in a >function, summary reports the following error: > >Error in eval(expr, envir, enclos) : object "dat" not found > >Someone knows how I can solve the problem? By giving us a short reproducible example? Specifically we do not know: 1 - what formula1 is 2 - what the structure of data1 is 3 - what the enclosing function looks like 4 - what dat is >Thanks for any help. >Paolo Michael Dewey http://www.aghmed.fsnet.co.uk ______________________________________________ R-help@stat.math.ethz.ch 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.