Skip to content
Back to formatted view

Raw Message

Message-ID: <A08A0B84-4DC5-475B-8BEB-8B0F03EA3AEA@imperial.ac.uk>
Date: 2013-03-18T12:36:53Z
From: Federico Calboli
Subject: How many samples ACTUALLY used in regression?

Dear All,

is there a simple way that covers all regression models to extract the number of samples from a data frame/matrix actually used in a regression model?

For instance I might have a data of 100 rows and 4 colums (1 response + 3 explanatory variables).  If 3 samples have one or more NAs in the explanatory variable columns these samples will be dropped in any model:

my.model = lm(y ~ x + w + z, my.data)
my.model = glm(y ~ x + w + z, my.data, family = binomial)
my.model = polr(y ~ x + w + z, my.data)
?

I don't seem to be able to find one single method that works in the exact same way -- irrespective of the model type -- to interrogate my.model to see how many samples of my.data were actually used.  Is there such function or do I need to hack something together?

Best wishes

Federico