[R] fitted.values less than observed values

David Winsemius dwinsemius at comcast.net
Tue Aug 4 19:27:44 CEST 2009

Your first posting made me think that you were complaining that the  
fitted values were less than the raw values. Your second posting makes  
me think that you may be conflating the English word "less" with  the  
word English "fewer". Many native speakers make the same error, but in  
this context it may be a critical problem for communicating what you  
are seeing (or not seeing).

Perhaps you could be more expansive about what you see and what you  
expect with explicit attention to the numbers involved? Even better  
would be small *reproducible* example.


On Aug 4, 2009, at 12:51 PM, Federico Calboli wrote:

> Actually, I tried doing
> data2 = unique(data)
> mod = lm(y ~ x1 + ... + xn, data2)
> fitted(mod)
> and I still get les fitted values than observations.
> Federico
> On 4 Aug 2009, at 12:18, Federico Calboli wrote:
>> Hi All,
>> I have some data where the dependent variable is a score, low (1:3)  
>> or
>> high (8:9), and the independent variables are 21 genotypic markers.
>> I'm fitting a logistic regression on the whole dataset after
>> transforming the score to 0/1 and normal linear regression on the  
>> high
>> and low subsets.
>> I all cases I have a numer of cases of data 'duplications', i.e.
>> different individuals with the same score and the same genotype at  
>> the
>> 21 markers.
>> When I do:
>> mod$fitted.values I get a number of fitted values corresponding to  
>> the
>> umber of unique lines in the dataset. Is there a way to have the
>> fitted  values match the observation, even though some are duplicated
>> and so have the same fitted value? I could do it by hand but it's
>> laborious and I'd venture there is a better way.
>> Best,
>> Federico

David Winsemius, MD
Heritage Laboratories
West Hartford, CT

More information about the R-help mailing list