[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: Re: RE: AW: IPF troubles

From   Adrian Mander <>
Subject   Re: st: Re: RE: AW: IPF troubles
Date   Mon, 18 May 2009 11:39:55 +0100

Dear All,

I have changed the help file to include the varlist optionality and other errors with the help file (thanks Nick Cox).
I have also introduced a check on the variables in the fit() option.

If someone actually uses a varlist it is for the purpose of defining the dimensionality of the data. This only ever happens when comparing models with differing number of variables specified in the fit() statement.

I have send the updated files to SSC but I have made it version 10.0.


Martin Weiss wrote:

I know, I know, I made multiple mistakes when thinking about the posts for this particular thread, including, but not limited to, using -findit- to find the thing and then clicking just one of the links to install and subsequently running -adoupdate-. I thought that would land me the latest version of -ipf-, only to discover later that mine was outdated by 6 years. Along this sequence of commands, I exaggerated the capabilities of one or more of them...

My complaint was that -ipf- does not check earlier for user input, possibly in the -syntax- statement which can catch trash early. If that is not possible, a few lines later one could add lines to check for specific errors. The one committed by Andrew is a very obvious one, as the help file almost invites him to submit a -string- variable. Instead -ipf- catches this error almost by accident.

A third prob was that I assumed all of this happened with a -varlist- in play when really it did not. Still, is the help file correct then? It seems from the syntax diagram that the -varlist- is mandatory which it obviously is not - look to the -syntax- statement in ipf.ado for corroboration. Should it not be put inside square brackets?

----- Original Message ----- From: "Nick Cox" <>
To: <>
Sent: Friday, May 15, 2009 7:01 PM
Subject: st: RE: AW: IPF troubles

Martin is pointing in one wrong direction and one right direction here.

What Andrew typed is totally consistent with the syntax declared in the
early lines of -ipf- to -syntax-, i.e.

syntax [varlist (default=none)] [fweight/] , FIT(string) [
CONstr(string) CONFILE(string) CONVARS(varlist) SAVE(string) EXPect
NOLOG ACC(real 0.000001)]

That is, the option -fit()- takes a string. In Andrew's case he supplied
a character string with an expression "gender + party". That's perfectly

-syntax- does not know or care what the string _means_. (Otherwise put,
-syntax- knows nothing about semantics.)

Thus in particular note that the predictors in the model are not passed
via the -varlist-. In fact, a varlist is optional, the default is none,
and in this case none was supplied. So there is literally nothing for
-syntax- to object to as far as the varlist is concerned.

However, as pointed out earlier in the thread by several people, what
Andrew typed included names of string variables, and that's not
consistent with the expectations of -ipf-, and is caught indirectly
later in the program, as Martin correctly points out.

What the -syntax- command could do in 2000, or can do now, is not
material here.


Martin Weiss

-trace-ing the thing shows that -ipf- does not catch the wrong type of
variable in your -varlist- at the first possible moment, i.e. in its
-syntax- statement, presumably because -syntax- was not capable of doing
that at the time the command was last edited, i.e. in 2000.

Stata finally chokes on a -drop- statement that asks it to compare the
string variable to the numeric missing value ".", which leads to the
mismatch" error. Hard to diagnose without the benefit of -trace-...

Andrew Criswell

This seems like a straight forward example. But I don't understand why
it fails. I am using version 10.1

input str6 gender str8 party wgt
gender party wgt
male democrat 55
male repub 65
female democrat 50
female repub 30

. ipf [fweight = wgt], fit(gender + party)
Deleting all matrices......

Expansion of the various marginal models
marginal model 1 varlist :  gender
marginal model 2 varlist :  party
type mismatch

end of do-file


*   For searches and help try:

*   For searches and help try:

Dr Adrian Mander
Leader of Cambridge Hub in Trials Methodology Research
MRC Biostatistics Unit Institute of Public Health University Forvie Site Cambridge CB2 0SR

Tel: 01223 330370       Fax: 01223 330365

*   For searches and help try:

© Copyright 1996–2017 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index