[R] delete categories

Mark Difford mark_difford at yahoo.co.uk
Mon Nov 17 20:37:33 CET 2008


Hi Ann,

>> Specifically it is for a MNL ...
>> How are you definng "response" and "predictor"?

You really are still leaving me, and I imagine other people on the list who
read your email, largely in the dark. (But since you don't seem to be
prepared to address anyone, or even the list, I don't suppose that really
matters.)

By MNL I presume you mean a multinomial logit model? But I still don't know
what you are trying to fit it with (perhaps multinom from the nnet package
?). And I still can't be sure that that is what an MNL is: we are not in the
same room, nor are we on the same page, nor do I have a clue what your
scientific background is.

To answer your question: I am not defining anything. I am showing you how to
use the formula interface to fit a model to a subset of your data.

There is plenty of adequate, to good, to excellent, documentation on how to
fit models in R, and on how to use functions in R generally. The best thing
you could do now, since you don't yet seem to be prepared to state your
problem clearly, is to read some of it. Perhaps start with the following:

?formula
?glm
library(nnet)
?multinom   ## see for an explanation of response ~ predictor in this
context

Regards, Mark.


Ann Leis wrote:
> 
> Specifically it is for a MNL  I just want to drop temporarily to run a
> test.  I have tried upData (dataset, g=as.numeric (g) but then I am not
> sure
> how I could apply na.omit to omit the variable.  How are you definng
> "response" and "predictor"?
> 
> On Mon, Nov 17, 2008 at 3:42 AM, Mark Difford
> <mark_difford at yahoo.co.uk>wrote:
> 
>>
>> Hi Ann,
>>
>> >> I want to delete one category from the dataset ... I have tried the
>> omit
>> >> command but it just returns TRUE and False values.
>>
>>
>> You are leaving the list to guess at what you have tried, and which
>> functions you are using.
>>
>> There are several different ways of omitting or dropping categories
>> (permanently?, or temporarily in a call to a function?). If the function
>> you
>> are using to fit the model uses the formula interface then the following
>> should do what you want. If not, then ... please read the posting guide.
>>
>> ##
>> glm(response ~ predictor, data = YourData, subset = Category != "G",
>> family
>> = ...)
>>
>> You will need to do the appropriate substitutions ... This should omit
>> the
>> data associated with category G.
>>
>> Regards, Mark.
>>
>>
>> Ann Leis wrote:
>> >
>> > I have a dataset which has categories A-G (7 categories) with
>> > corresponding
>> > x and y variables.  I want to delete one category from the dataset and
>> run
>> > a
>> > logit model on only 6 categories instead of 7. How do I delete a
>> category?
>> > I
>> > have tried the omit command but it just returns TRUE and False values.
>> >
>> >       [[alternative HTML version deleted]]
>> >
>> > ______________________________________________
>> > R-help at r-project.org mailing list
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> >
>> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
>> > and provide commented, minimal, self-contained, reproducible code.
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/delete-categories-tp20533194p20535629.html
>> Sent from the R help mailing list archive at Nabble.com.
>>
>> ______________________________________________
>> R-help at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html>
>> and provide commented, minimal, self-contained, reproducible code.
>>
> 
> 	[[alternative HTML version deleted]]
> 
> ______________________________________________
> R-help at r-project.org 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/delete-categories-tp20533194p20546548.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list