#---Specifier le répertoire de travai
setwd("C:\\Users\\Pounie\\Documents\\Universite_Laval_21-22\\Gestion\\JeuDeDonnees\\Donnees_30mars\\fichiersR_grues\\Analyse_grues")
#---Importer les données
champs<- read.table("C:/Users/Pounie/Documents/Universite_Laval_21-22/Gestion/JeuDeDonnees/Donnees_30mars/fichiersR_grues/Champs.txt", header=TRUE)
#---Ajouter la colonne pour la proportion de champs ravagée
champs$Ratio_Sup_ravage_ha_Sup_tot<-champs$Sup_ravage_ha/champs$Sup_to
#---Renommer colonne proportion de champs ravagée
names(champs)[names(champs) == "Ratio_Sup_ravage_ha_Sup_tot"] <- "prop_ravage"
#---isoler traitement
traitement<-champs[champs$Traitements=="Laser.et.chasse",]
#---transformation
traitement$prop_ravage.log<-log1p(traitement$prop_ravage)
#---reg_traitement
reg_traitement<-lm(traitement$prop_ravage.log~traitement$Annee)
summary(reg_traitement)
##
## Call:
## lm(formula = traitement$prop_ravage.log ~ traitement$Annee)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.148872 -0.037456 0.003244 0.034968 0.138797
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.405676 0.008659 46.85 <2e-16 ***
## traitement$Annee -0.042470 0.001396 -30.43 <2e-16 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.05669 on 198 degrees of freedom
## Multiple R-squared: 0.8239, Adjusted R-squared: 0.823
## F-statistic: 926.1 on 1 and 198 DF, p-value: < 2.2e-16
plot(traitement$prop_ravage.log~traitement$Annee, pch=20)
abline(reg_traitement)
#---Condition application
par(mfrow=c(2,2))
plot(reg_traitement)
Période des 5 premières années
#---Periode 5 premieres années
traitement5<-traitement[traitement$Annee==c(1,2,3,4,5),]
#---Analyse de régression, 5 premieres années
reg5<- lm(traitement5$prop_ravage~traitement5$Annee)
summary(reg5)
##
## Call:
## lm(formula = traitement5$prop_ravage ~ traitement5$Annee)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.12023 -0.05756 -0.01774 0.04637 0.18606
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.50369 0.04509 11.172 1.58e-09 ***
## traitement5$Annee -0.06462 0.01359 -4.753 0.000159 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.08597 on 18 degrees of freedom
## Multiple R-squared: 0.5566, Adjusted R-squared: 0.532
## F-statistic: 22.59 on 1 and 18 DF, p-value: 0.0001588
#--- Graphique de régression, 5 premières années
plot(traitement5$prop_ravage~traitement5$Annee, pch=20, xlab="Années", ylab="Proportion de champs endommagée", main ="Proportion de champs endommagée selon l'année, 5 premières années")
#--- Conditions application 5 premières années
par(mfrow=(c(2,2)))
plot(reg5)
#---Analyse de régression, 5 premieres années
reg5<- lm(traitement5$prop_ravage~traitement5$Annee)
summary(reg5)
##
## Call:
## lm(formula = traitement5$prop_ravage ~ traitement5$Annee)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.12023 -0.05756 -0.01774 0.04637 0.18606
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.50369 0.04509 11.172 1.58e-09 ***
## traitement5$Annee -0.06462 0.01359 -4.753 0.000159 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.08597 on 18 degrees of freedom
## Multiple R-squared: 0.5566, Adjusted R-squared: 0.532
## F-statistic: 22.59 on 1 and 18 DF, p-value: 0.0001588
Période des 5 dernières années
#--- Traitement en fonction du temps 5 dernières années
traitement10<-traitement[traitement$Annee==c(6,7,8,9,10),]
#---Analyse de régression 5 dernières années
reg10<- lm(traitement10$prop_ravage~traitement10$Annee)
summary(reg10)
##
## Call:
## lm(formula = traitement10$prop_ravage ~ traitement10$Annee)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.097620 -0.018639 -0.005639 0.020314 0.095436
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.282345 0.054426 5.188 6.2e-05 ***
## traitement10$Annee -0.026389 0.006699 -3.939 0.000962 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.04237 on 18 degrees of freedom
## Multiple R-squared: 0.4629, Adjusted R-squared: 0.4331
## F-statistic: 15.52 on 1 and 18 DF, p-value: 0.000962
#---Graphique de régression, 5 dernières années
plot(traitement10$prop_ravage~traitement10$Annee, pch=20, xlab="Années", ylab="Proportion de champs endommagée", main ="Proportion de champs endommagée selon l'année, 5 dernières années")
#---Conditions appplication 5 dernières années
par(mfrow=(c(2,2)))
plot(reg10)
Transformation
reg10.log<-lm(traitement10$prop_ravage.log~traitement10$Annee)
summary(reg10.log )
##
## Call:
## lm(formula = traitement10$prop_ravage.log ~ traitement10$Annee)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.091939 -0.018671 -0.003987 0.019729 0.086634
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.262897 0.050138 5.243 5.5e-05 ***
## traitement10$Annee -0.024423 0.006172 -3.957 0.000924 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.03903 on 18 degrees of freedom
## Multiple R-squared: 0.4652, Adjusted R-squared: 0.4355
## F-statistic: 15.66 on 1 and 18 DF, p-value: 0.0009238
par(mfrow=(c(2,2)))
plot(reg10.log)
traitement10$prop_ravage.sin<-sin(sqrt(traitement10$prop_ravage))
reg10.sin<-lm(traitement10$prop_ravage.sin~traitement10$Annee)
summary(reg10.sin )
##
## Call:
## lm(formula = traitement10$prop_ravage.sin ~ traitement10$Annee)
##
## Residuals:
## Min 1Q Median 3Q Max
## -0.28612 -0.02907 0.01807 0.05211 0.16598
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 0.67180 0.12947 5.189 6.18e-05 ***
## traitement10$Annee -0.05510 0.01594 -3.457 0.00281 **
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 0.1008 on 18 degrees of freedom
## Multiple R-squared: 0.399, Adjusted R-squared: 0.3657
## F-statistic: 11.95 on 1 and 18 DF, p-value: 0.002811
Les transformation n’améliore pas de manière significative les résultats…
Corrélation de Pearson 5 dernieres années
#---Correlation Pearson 5 dernieres
pear10<-cor.test(traitement10$Annee,traitement10$prop_ravage)
cor.test(traitement10$Annee,traitement10$prop_ravage)
##
## Pearson's product-moment correlation
##
## data: traitement10$Annee and traitement10$prop_ravage
## t = -3.9391, df = 18, p-value = 0.000962
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.8630612 -0.3403594
## sample estimates:
## cor
## -0.6804009
#---Régression
droite.10<-lm(traitement10$prop_ravage~traitement10$Annee)
#---Générer le graphique
plot(traitement10$Annee,traitement10$prop_ravage, pch = 20, xlab="Années", ylab = "Proportion champs endommagée", main="Proportion champs endommagée selon le temps, 5 dernières années")
#--- Droite de régression
abline(droite.10, col="red")
#--- Correlation Pearson 5 premieres
cor.test(traitement5$prop_ravage,traitement5$Annee)
##
## Pearson's product-moment correlation
##
## data: traitement5$prop_ravage and traitement5$Annee
## t = -4.7534, df = 18, p-value = 0.0001588
## alternative hypothesis: true correlation is not equal to 0
## 95 percent confidence interval:
## -0.8935660 -0.4531234
## sample estimates:
## cor
## -0.746049
#---Régression
droite.5<-lm(traitement5$prop_ravage~traitement5$Annee)
#---Générer le graphique
plot(traitement5$Annee,traitement5$prop_ravage, pch = 20, xlab="Années", ylab = "Proportion champs endommagée", main="Proportion champs endommagée selon le temps, 5 premières années")
#--- Droite de régression
abline(droite.5, col="red")
Même Corrélation négative entre les deux variable. pvalue rejette H0