Hi!

I am having troubling fitting two linear regression models.

My dataset, named 'heart', contains mode of treatment (trtment) for congenital heart disease in infants, with 0 standing for circulatory arrest treatment and 1 for low-flow bypass treatment. Psychomotor Development Index (PDI) score and Mental Development Index (MDI) score are then noted against the type of treatment administered to the infant.

I am to fit two linear regression models, one with PDI score as the response and the another with Mental Development Index (MDI) score as the response.

I am using the following command for PDI and I am not getting the correct output to construct a linear model.

fit <- with(heart, lm(trtment~pdi))

fit

Call:

lm(formula = trtment ~ pdi)

Coefficients:

(Intercept) pdi104 pdi105 pdi109 pdi110 pdi111 pdi114 pdi115 pdi117

1.617e-14 5.000e-01 2.727e-01 1.000e+00 6.667e-01 2.500e-01 1.000e+00 1.000e+00 3.333e-01

pdi118 pdi120 pdi122 pdi124 pdi130 pdi134 pdi50 pdi52 pdi60

1.000e+00 1.000e+00 7.500e-01 1.000e+00 -1.530e-14 -1.390e-14 1.000e+00 1.000e+00 -1.508e-14

pdi63 pdi66 pdi67 pdi70 pdi71 pdi75 pdi76 pdi77 pdi78

-1.629e-14 -1.438e-14 -1.449e-14 3.333e-01 -1.604e-14 5.000e-01 -1.428e-14 -1.618e-14 -1.534e-14

pdi80 pdi82 pdi86 pdi87 pdi90 pdi92 pdi93 pdi98 pdi99

4.545e-01 -1.348e-14 2.000e-01 3.333e-01 1.000e+00 6.667e-01 7.500e-01 6.522e-01 6.000e-01

If I use this following command instead, I am still getting an error message and incorrect output;

fit <- with(heart, lm(pdi~trtment))

Warning messages:

1: In model.response(mf, "numeric") :

using type = "numeric" with a factor response will be ignored

2: In Ops.factor(y, z$residuals) : ‘-’ not meaningful for factors

I will really appreciate if someone could help me troubleshoot my commands as I need to model both PDI and MDI.

Thanks.

Cheers!