[R] fitted.values less than observed values
Federico Calboli
f.calboli at imperial.ac.uk
Tue Aug 4 19:29:33 CEST 2009
On 4 Aug 2009, at 18:27, David Winsemius wrote:
> 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).
ok, so what I meant is
length(mod$fitted) < length(observations)
> 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.
I'll have to cook that up, the data is more or less confidential. Not
very much but enough no to go on google ;)
F
>
> --
> David
>
> 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
>
--
Federico C. F. Calboli
Department of Epidemiology and Public Health
Imperial College, St. Mary's Campus
Norfolk Place, London W2 1PG
Tel +44 (0)20 75941602 Fax +44 (0)20 75943193
f.calboli [.a.t] imperial.ac.uk
f.calboli [.a.t] gmail.com
More information about the R-help
mailing list