cargar packages
library(googlesheets4)
library(ggplot2)
Los datos están en el archivo Regres_datos
Copiar el siguiente código, tal y como está
gs4_deauth()
ss= "https://docs.google.com/spreadsheets/d/1Oo4bO83z8MyTvxyXSAbC6ucVuLPOjBw0ZYRnXTM87G4/edit?usp=sharing"
hoja= "Hoja1"
rango = "A1:D18"
caso1 <- read_sheet(ss,
sheet= hoja,
range= rango,
col_names= TRUE
)
modelo respuesta -> species predictora -> latitude
head(caso1)
## # A tibble: 6 x 4
## town state latitude species
## <chr> <chr> <dbl> <dbl>
## 1 Bombay Hook DE 39.2 128
## 2 Cape Henlopen DE 38.8 137
## 3 Middletown DE 39.5 108
## 4 Milford DE 39.0 118
## 5 Rehoboth DE 38.6 135
## 6 Seaford-Nanticoke DE 38.6 94
summary(caso1)
## town state latitude species
## Length:17 Length:17 Min. :37.20 Min. : 94
## Class :character Class :character 1st Qu.:38.32 1st Qu.:108
## Mode :character Mode :character Median :38.60 Median :118
## Mean :38.64 Mean :120
## 3rd Qu.:39.13 3rd Qu.:128
## Max. :39.73 Max. :157
# plot
plot(data=caso1, species ~ latitude, pch=20, cex=1.5)
reg1 <- lm(data=caso1, species ~ latitude)
summary(reg1)
##
## Call:
## lm(formula = species ~ latitude, data = caso1)
##
## Residuals:
## Min 1Q Median 3Q Max
## -26.635 -11.198 -1.993 14.569 28.162
##
## Coefficients:
## Estimate Std. Error t value Pr(>|t|)
## (Intercept) 585.145 230.024 2.544 0.0225 *
## latitude -12.039 5.953 -2.022 0.0613 .
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Residual standard error: 16.37 on 15 degrees of freedom
## Multiple R-squared: 0.2143, Adjusted R-squared: 0.1619
## F-statistic: 4.09 on 1 and 15 DF, p-value: 0.06134
#### ggplot
ggplot(data= caso1, aes(x=latitude, y= species)) +
geom_point(size=2) +
geom_smooth(method="lm")
==========================================
Copiar el siguiente código, tal y como está
gs4_deauth()
ss= "https://docs.google.com/spreadsheets/d/1Oo4bO83z8MyTvxyXSAbC6ucVuLPOjBw0ZYRnXTM87G4/edit?usp=sharing"
hoja= "Hoja2"
rango = "A1:B19"
caso2 <- read_sheet(ss,
sheet= hoja,
range= rango,
col_names= TRUE
)
modelo respuesta -> pitch predictora -> volume
head(caso2)
## # A tibble: 6 x 2
## volume pitch
## <dbl> <dbl>
## 1 1760 529
## 2 2040 566
## 3 2440 473
## 4 2550 461
## 5 2730 465
## 6 2740 532
summary(caso2)
## volume pitch
## Min. :1760 Min. :389.0
## 1st Qu.:2732 1st Qu.:437.8
## Median :3555 Median :470.5
## Mean :4192 Mean :471.7
## 3rd Qu.:5308 3rd Qu.:487.2
## Max. :7960 Max. :566.0
# plot
plot(data=caso2, pitch ~ volume, pch=20, cex=1.5)
** Aquí no se muestra el resultado del análisis **
reg1 <- lm(data=caso2, pitch ~ volume)
summary(reg1)
ggplot(data= caso2, aes(x=volume, y= pitch)) +
geom_point(size=2) +
geom_smooth(method="lm")
=====================================
Copiar el siguiente código, tal y como está
gs4_deauth()
ss= "https://docs.google.com/spreadsheets/d/1Oo4bO83z8MyTvxyXSAbC6ucVuLPOjBw0ZYRnXTM87G4/edit?usp=sharing"
hoja= "Hoja3"
rango = "A1:C32"
caso3 <- read_sheet(ss,
sheet= hoja,
range= rango,
col_names= TRUE
)
modelo respuesta -> Pulse predictora -> Temp
head(caso3)
## # A tibble: 6 x 3
## Species Temp Pulse
## <chr> <dbl> <dbl>
## 1 ex 20.8 67.9
## 2 ex 20.8 65.1
## 3 ex 24 77.3
## 4 ex 24 78.7
## 5 ex 24 79.4
## 6 ex 24 80.4
summary(caso3)
## Species Temp Pulse
## Length:31 Min. :17.20 Min. : 44.30
## Class :character 1st Qu.:20.80 1st Qu.: 59.45
## Mode :character Median :24.00 Median : 76.20
## Mean :23.76 Mean : 72.89
## 3rd Qu.:26.35 3rd Qu.: 85.25
## Max. :30.40 Max. :101.70
# plot
plot(data=caso3, Pulse ~ Temp, pch=20, cex=1.5)
** Aquí no se muestra el resultado del análisis **
reg1 <- lm(data=caso3, Pulse ~ Temp)
summary(reg1)
ggplot(data= caso3, aes(x=Temp, y= Pulse)) +
geom_point(size=2) +
geom_smooth(method="lm")
========================================================
Copiar el siguiente código, tal y como está
gs4_deauth()
ss= "https://docs.google.com/spreadsheets/d/1CMPY0Bjm6Kc3XUq0mZtgIoyXAacdWVkv2KONh0T-inU/edit?usp=sharing"
hoja= "bird"
rango = "A1:O27"
bird <- read_sheet(ss,
sheet= hoja,
range= rango,
col_names= TRUE,
na = "NA"
)
modelo respuesta -> Mass predictora -> Length
head(bird)
## # A tibble: 6 x 15
## Species Status Length Mass Range Migr Insect Diet Clutch Broods Wood
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Bra_sa~ 0 50 1930 0.01 1 0 1 4 2 0
## 2 Cer_no~ 1 870 3360 0.07 1 0 1 4 1 0
## 3 Pad_or~ 0 160 NA 0.09 1 0 1 5 NA 0
## 4 Cyg_at~ 1 1250 5000 0.56 1 0 1 6 1 0
## 5 Ocy_lo~ 0 330 205 0.76 1 0 1 2 7 1
## 6 Lon_pu~ 0 110 13.5 1.06 1 0 1 5 3 0
## # ... with 4 more variables: Upland <dbl>, Water <dbl>, Release <dbl>,
## # Indiv <dbl>
tail(bird)
## # A tibble: 6 x 15
## Species Status Length Mass Range Migr Insect Diet Clutch Broods Wood
## <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 Tet_te~ 0 470 900 4.17 1 3 1 7.9 1 1
## 2 Car_sp~ 0 117 12 2.09 3 3 1 4 2 1
## 3 Lon_ca~ 0 100 NA 0.13 1 4 1 5 NA 0
## 4 Emb_gu~ 0 120 19 0.15 1 4 1 5 3 0
## 5 Tym_cu~ 0 435 770 0.26 1 4 1 12 1 0
## 6 Poe_gu~ 0 100 12.4 0.75 1 4 1 4.7 3 0
## # ... with 4 more variables: Upland <dbl>, Water <dbl>, Release <dbl>,
## # Indiv <dbl>
# plot
plot(data=bird, Mass ~ Length, pch=20, cex=1.5)
** Aquí no se muestra el resultado del análisis **
reg1 <- lm(data=bird, Mass ~ Length)
summary(reg1)
ggplot(data= bird, aes(x=Length, y= Mass)) +
geom_point(size=2) +
geom_smooth(method="lm")
## Warning: Removed 2 rows containing non-finite values (stat_smooth).
## Warning: Removed 2 rows containing missing values (geom_point).