[R] Independent variables omitted in lm and glm
elaine kuo
elaine.kuo.tw at gmail.com
Tue Aug 17 05:16:30 CEST 2010
sorry I forget the attachments
Dear List,
>
>
>
> Some independent variable were missing in calculation using lm and glm
> (gaussian).
>
> (X= Y1+Y2+…..+Y16, Independent number: 16 variable)
>
> However, those variables did work well in cor(X, Y) respectively.
>
> str(dataframe) was also run to ensure that the variables were all numbers.
>
>
>
> Moreover, the missing variables were different in lm and glm.
>
> In lm, 3 factors were not taken into consideration.
>
> In glm, only one of them was omitted.
>
> (attached 2 shots)
>
>
>
> Please kindly advise whether further info is in need to solve the issue.
>
> Also, if similar problems have been encountered, please kindly share your
> experience.
>
> Thank you.
>
>
> Elaine
>
>
>
>
>
> Code
>
> rm(list=ls())
>
> library(MuMIn)
>
>
>
> datam <-read.csv("c:/migration/Mig_ratio_20100817.csv",header=T,
> row.names=1)
>
>
>
> dim(datam)
>
> datam[1,]
>
>
>
> # original regression model (16 indep. variables)
>
> Mig.lm
> <-lm(datam$SummerM_ratio~datam$temp_ran+datam$temp_mean+datam$temp_max+datam$temp_min+datam$evi_ran+datam$evi_mean+datam$evi_max+datam$evi_min+datam$prec_ran+datam$prec_mean+datam$prec_max+datam$prec_min+datam$topo_var+datam$topo_mean+datam$coast+datam$Iso_index_0808,data=datam)
>
>
>
> summary(mig.lm)
>
>
>
> mig.glm
> <-glm(datam$SummerM_ratio~datam$temp_ran+datam$temp_mean+datam$temp_max+datam$temp_min+datam$evi_ran+datam$evi_mean+datam$evi_max+datam$evi_min+datam$prec_ran+datam$prec_mean+datam$prec_max+datam$prec_min+datam$topo_var+datam$topo_mean+datam$coast+datam$Iso_index_0808,data=datam,family=gaussian)
>
>
>
> summary(mig.glm)
>
More information about the R-help
mailing list