Related
this is my first so please be patient with me.
I want to split one column of a tibble into two columns depending on the value of a third column.
My table looks like this so far
Wertetabelle <- tibble(DAT$Tag, DAT$Lauf, DAT$Replikate, DAT$Wert) %>% group_by(DAT$Lauf)
Wertetabelle %>%
mutate_all(linebreak) %>%
kable(booktabs = T, digits = 2,
caption = "Rohdaten der PCR Messungen",
col.names = linebreak(c("Tag", " Lauf", "Replikat", "Wert"), align = "r")) %>%
kable_styling(latex_options = c("striped", "hold_position"))
This, unfortunately, gives me a very long table. The column "Wert" has at least 80 values.
So depending on the "Replikat" column which has two values (1:2) I could split up "Wert" into two columns with 40 values each.
Unfortunately, the group_by doesn't work, it seems.
Do you have any idea?
Tag has 20 values 1:20
Lauf has 2 values 1:2
Replikat has 2 values 1:2
Wert is numeric
Best
Werek
as requested please find the results of dput(.)
structure(list(`DAT$Tag` = structure(c(1L, 2L, 3L, 4L, 5L, 6L,
7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L,
20L, 1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L,
14L, 15L, 16L, 17L, 18L, 19L, 20L, 1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L,
1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L,
15L, 16L, 17L, 18L, 19L, 20L), .Label = c("1", "2", "3", "4",
"5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15",
"16", "17", "18", "19", "20"), class = "factor"), `DAT$Lauf` = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("1",
"2"), class = "factor"), `DAT$Replikate` = structure(c(1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L), .Label = c("1",
"2"), class = "factor"), `DAT$Wert` = c(242L, 243L, 247L, 249L,
246L, 244L, 241L, 245L, 243L, 244L, 252L, 249L, 242L, 246L, 247L,
240L, 241L, 244L, 241L, 247L, 246L, 242L, 239L, 241L, 242L, 245L,
246L, 245L, 239L, 246L, 251L, 248L, 240L, 249L, 248L, 238L, 244L,
244L, 239L, 240L, 245L, 238L, 241L, 250L, 243L, 251L, 245L, 243L,
244L, 247L, 247L, 251L, 251L, 248L, 245L, 239L, 245L, 237L, 247L,
245L, 246L, 238L, 240L, 245L, 240L, 247L, 247L, 245L, 245L, 239L,
241L, 246L, 245L, 240L, 246L, 242L, 248L, 242L, 245L, 242L)), row.names = c(NA,
-80L), groups = structure(list(`DAT$Lauf` = structure(1:2, .Label = c("1",
"2"), class = "factor"), .rows = structure(list(c(1L, 2L, 3L,
4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L,
18L, 19L, 20L, 41L, 42L, 43L, 44L, 45L, 46L, 47L, 48L, 49L, 50L,
51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L), c(21L, 22L,
23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L, 34L, 35L,
36L, 37L, 38L, 39L, 40L, 61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L,
69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L, 77L, 78L, 79L, 80L)), ptype = integer(0), class = c("vctrs_list_of",
"vctrs_vctr", "list"))), row.names = 1:2, class = c("tbl_df",
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",
"tbl_df", "tbl", "data.frame"))
Here is the problem:
When I use cook's distance to check influential points in SLR, I used two methods.
First one:
plot(mortality.model, which = 4)
This one gives me the correct answer.
Second one:
plot(cooks.distance(mortality.model), type = 'p')
identify(cooks.distance(mortality.model))
This one gives me the wrong answer, but very close to the correct answer.
Read the data set:
df.mortality <- read.csv("mortality.csv", header = TRUE)
Build the model:
mortality.model <- lm(log(infant) ~ log(income))
By the way, the dataset has NA values. If you would like to see the dataset, I could email it to you.
The dput result:
structure(list(X = structure(c(4L, 5L, 7L, 15L, 23L, 29L, 30L, 101L,
41L,43L, 46L, 61L, 62L, 66L, 73L, 79L, 86L, 87L, 10L, 97L, 2L, 25L, 38L,
39L, 40L, 52L, 65L, 75L, 100L, 3L, 9L, 18L, 19L, 21L, 24L, 32L, 33L, 42L,
45L, 50L, 55L, 58L, 63L, 68L, 71L, 77L, 83L, 89L, 93L, 94L, 99L, 103L,
105L, 8L, 14L, 20L, 26L, 27L, 31L, 36L, 44L, 47L, 80L, 51L, 59L, 69L, 70L,
72L, 88L, 91L, 95L, 81L, 1L, 6L,11L, 12L, 13L, 16L, 17L, 22L, 28L, 34L,
35L, 37L, 48L, 49L, 53L, 54L, 56L, 57L, 60L, 64L, 67L, 74L, 76L, 78L, 84L,
85L, 90L, 92L, 96L, 98L, 82L, 102L, 104L), .Label = c("Afganistan",
"Algeria", "Argentina", "Australia", "Austria", "Bangladesh","Belgium",
"Bolivia", "Brazil", "Britain", "Burma","Burundi","Cambodia","Cameroon",
"Canada", "Central.African.Republic", "Chad","Chile", "Colombia","Congo",
"Costa.Rica", "Dahomey", "Denmark", "Dominican.Republic", "Ecuador",
"Egypt", "El.Salvador", "Ethiopia", "Finland", "France", "Ghana",
"Greece", "Guatemala", "Guinea", "Haiti", "Honduras", "India",
"Indonesia", "Iran", "Iraq", "Ireland", "Israel", "Italy", "Ivory.Coast",
"Jamaica", "Japan", "Jordan", "Kenya", "Laos", "Lebanon", "Liberia",
"Libya", "Madagascar", "Malawi", "Malaysia", "Mali", "Mauritania",
"Mexico", "Moroco", "Nepal", "Netherlands", "New.Zealand", "Nicaragua",
"Niger", "Nigeria", "Norway", "Pakistan", "Panama", "Papua.New.Guinea",
"Paraguay", "Peru", "Philippines", "Portugal", "Rwanda", "Saudi.Arabia",
"Sierra.Leone", "Singapore", "Somalia", "South.Africa", "South.Korea",
"South.Vietnam", "Southern.Yemen", "Spain", "Sri.Lanka", "Sudan",
"Sweden", "Switzerland", "Syria", "Taiwan", "Tanzania", "Thailand",
"Togo", "Trinidad.and.Tobago", "Tunisia", "Turkey", "Uganda",
"United.States", "Upper.Volta", "Uruguay", "Venezuela", "West.Germany",
"Yemen", "Yugoslavia", "Zaire", "Zambia"), class = "factor"),
income = c(3426L, 3350L, 3346L, 4751L, 5029L, 3312L, 3403L,
5040L, 2009L, 2298L, 3292L, 4103L, 3723L, 4102L, 956L, 1000L,
5596L, 2963L, 2503L, 5523L, 400L, 250L, 110L, 1280L, 560L,
3010L, 220L, 1530L, 1240L, 1191L, 425L, 590L, 426L, 725L,
406L, 1760L, 302L, 2526L, 727L, 631L, 295L, 684L, 507L, 754L,
335L, 1268L, 1256L, 261L, 732L, 434L, 799L, 406L, 310L, 200L,
100L, 281L, 210L, 319L, 217L, 284L, 387L, 334L, 344L, 197L,
279L, 477L, 347L, 230L, 334L, 210L, 435L, 130L, 75L, 100L,
73L, 68L, 123L, 122L, 70L, 81L, 79L, 79L, 100L, 93L, 169L,
71L, 120L, 130L, 50L, 174L, 90L, 70L, 102L, 61L, 148L, 85L,
162L, 125L, 120L, 160L, 134L, 82L, 96L, 77L, 118L), infant = c(26.7,
23.7, 17, 16.8, 13.5, 10.1, 12.9, 20.4, 17.8, 25.7, 11.7,
11.6, 16.2, 11.3, 44.8, 71.5, 9.6, 12.8, 17.5, 17.6, 86.3,
78.5, 125, NA, 28.1, 300, 58, 650, 51.7, 59.6, 170, 78, 62.8,
54.4, 48.8, 27.8, 79.1, 22.1, 26.2, 13.6, 32, 60.9, 46, 34.1,
65.1, 20.4, 15.1, 19.1, 26.2, 76.3, 40.4, 43.3, 259, 60.4,
137, 180, 114, 58.2, 63.7, 39.3, 138, 21.3, 58, 159.2, 149,
10.2, 38.6, 67.9, 21.7, 27, 153, 100, 400, 124.3, 200, 150,
100, 190, 160, 109.6, 84.2, 216, NA, 60.6, 55, NA, 102, 148.3,
120, 187, NA, 200, 124.3, 132.9, 170, 158, 45.1, 129.4, 162.5,
127, 160, 180, 80, 50, 104), region = structure(c(3L, 4L,
4L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 4L, 4L, 1L, 4L,
4L, 4L, 2L, 1L, 2L, 3L, 3L, 3L, 1L, 1L, 3L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 4L, 2L, 3L, 2L, 3L, 3L, 2L, 2L, 2L, 2L, 3L, 4L,
3L, 2L, 1L, 2L, 4L, 1L, 2L, 1L, 1L, 1L, 2L, 1L, 2L, 1L, 3L,
3L, 1L, 1L, 3L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 3L,
1L, 1L, 1L, 1L, 1L, 2L, 3L, 1L, 3L, 1L, 1L, 1L, 1L, 3L, 1L,
3L, 1L, 1L, 1L, 3L, 1L, 1L, 1L, 1L, 1L, 3L, 3L, 1L), .Label = c("Africa",
"Americas", "Asia", "Europe"), class = "factor"), oil = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c("no",
"yes"), class = "factor")), class = "data.frame", row.names = c(NA,
-105L))
Thanks!
Here are results:The correct answer The wrong answer
Could anyone explain why it happened?
Overview:
I am undertaking a study regarding how latitude influences leaf senescence (leaf loss) in deciduous oak trees Q. Robur.
I am completely new to producing maps in R and I have been trying to produce the desired results for a couple of days without success.
If anyone can help, I would be deeply appreciative.
Problems:
I produced a map of the UK using my_map() (see diagram 1) and I have a data frame called lonlat_df containing the longitude and latitude coordinates for all oak trees recorded.
I am trying to incorporate the tree data points onto the map of the UK using geom_point(). However, I am unsure how to integrate the map, the GPS points for the tree species, and the key parameter objects together.
My goal
To produce 3 separate maps of the UK showing the GPS points (see desired output below) for each oak tree species recorded in the study, but I would like the points to be 4 different colours to correlate with each key parameter category (see below), in conjunction with a legend for each parameter category.
Key Parameters:
Urbanisation Index: 1=Urban, 2=Suburban, 3=village, 4=rural
Stand Density Index: 1=standing alone, 2=within a few trees or close proximity to other trees, 3=within a stand of 10-30 trees, and 4=large or woodland
Phenological Index: 1=no indication of autumn timing, 2=first autumn tinting, 3=partial autumn tinting (>25% of leaves), and 4=advanced autumn tinting (>75% of leaves)
R-code
##Import Packages
library(ggplot2)
library(maps)
library(mapdata)
library(tidyverse)
##Create objects for the key parameters from the data frame below called QuercusRobur1 to use as point data
latitude<-QuercusRobur1$Latitude
longitude<-QuercusRobur1$Longitude
PhenologyIndex<-QuercusRobur1$Phenological_Index
StandDensityIndex<-QuercusRobur1$Stand_density_index
UrbanisationIndex<-QuercusRobur1$Urbanisation_index
Species<-QuercusRobur1$Species
##Produce new data frame
lonlat_df<-as.data.frame(cbind(longitude, latitude, PhenologyIndex))
head(lonlat_df)
##Produce a map of the UK from maps:
UK <- map_data(map = "world", region = "UK")
head(UK)
dim(UK)
##Visualise the map of the UK using ggplot()
dev.new()
UK.Map<-ggplot(data = UK, aes(x = long, y = lat, group = group)) +
geom_point(colour="red", size=3, alpha=0.2)+
geom_polygon() +
coord_map()
##Produce Point Data
MapPoints<- MapUK + geom_point(data=lonlat_df, aes(x=long, y=lat, group=PhenologyIndex), colour="red", shape=21, fill="red", size=0.5)
Diagram 1
Desired output:
I would like to overlay the type of points shown in the desired output below on the map of the UK produced from the R-code above.
Dataframe
structure(list(Obs_.no = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 19L,
20L, 21L, 22L, 23L, 24L, 25L, 28L, 29L, 30L, 31L, 32L, 33L, 34L,
35L, 36L, 37L, 38L, 39L, 44L, 45L, 46L, 47L, 57L, 58L, 59L, 60L,
61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 74L,
75L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 93L,
102L, 103L, 104L, 112L, 113L, 114L, 115L, 116L, 117L, 118L, 119L,
120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L, 128L, 129L, 130L,
131L, 135L, 136L, 137L, 138L, 143L, 144L, 145L, 146L, 147L, 148L,
149L, 150L, 151L, 152L, 153L, 154L, 155L, 158L, 159L, 160L, 161L,
162L, 163L, 164L, 165L, 169L, 170L, 171L, 172L, 177L, 178L, 179L,
180L, 181L, 182L, 183L, 184L, 185L, 186L, 187L, 188L, 189L, 190L,
191L, 192L, 193L, 194L, 195L, 196L, 200L, 201L, 202L, 203L, 204L,
205L, 206L, 207L, 208L, 210L, 212L, 214L, 215L, 216L, 217L, 218L,
219L, 220L, 221L, 233L, 234L, 235L, 237L, 239L, 246L, 255L, 256L,
257L, 258L, 260L, 261L, 262L, 263L, 264L, 265L, 266L, 277L, 278L,
279L, 280L, 281L, 282L, 283L, 284L, 285L, 286L, 287L, 288L, 289L,
290L, 291L, 292L, 293L, 294L, 295L, 296L), Date_observed = structure(c(4L,
15L, 6L, 6L, 6L, 6L, 2L, 2L, 8L, 8L, 8L, 8L, 8L, 8L, 6L, 6L,
6L, 6L, 6L, 6L, 11L, 11L, 11L, 11L, 12L, 7L, 7L, 9L, 9L, 9L,
9L, 5L, 5L, 5L, 5L, 14L, 14L, 14L, 14L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 6L, 6L, 5L, 5L, 9L, 9L, 9L, 9L, 3L, 3L, 3L, 3L, 4L, 4L,
1L, 1L, 11L, 6L, 6L, 6L, 6L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 3L, 3L, 3L, 3L, 11L,
11L, 11L, 4L, 4L, 4L, 4L, 8L, 8L, 10L, 10L, 10L, 10L, 9L, 9L,
9L, 9L, 3L, 3L, 3L, 3L, 9L, 9L, 9L, 9L, 2L, 2L, 2L, 2L, 13L,
13L, 13L, 13L, 8L, 8L, 8L, 8L, 10L, 10L, 10L, 10L, 3L, 3L, 3L,
3L, 13L, 13L, 13L, 13L, 9L, 9L, 10L, 10L, 10L, 2L, 2L, 3L, 3L,
3L, 3L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 5L, 5L, 11L, 9L, 9L, 9L,
9L, 10L, 10L, 10L, 10L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 11L, 11L, 11L, 11L, 6L, 6L, 6L, 6L, 11L, 11L, 11L, 11L), .Label = c("10/1/18",
"10/19/18", "10/20/18", "10/21/18", "10/22/18", "10/23/18", "10/24/18",
"10/25/18", "10/26/18", "10/27/18", "10/28/18", "10/28/19", "10/29/18",
"12/9/18", "8/20/18"), class = "factor"), Latitude = c(51.4175,
52.12087, 52.0269, 52.0269, 52.0269, 52.0269, 52.947709, 52.947709,
51.491811, 51.491811, 52.59925, 52.59925, 52.59925, 52.59925,
51.60157, 51.60157, 52.6888, 52.6888, 52.6888, 52.6888, 50.697802,
50.697802, 50.697802, 50.697802, 53.62417, 50.446841, 50.446841,
53.959679, 53.959679, 53.959679, 53.959679, 51.78375, 51.78375,
51.78375, 51.78375, 51.456965, 51.456965, 51.456965, 51.456965,
51.3651, 51.3651, 51.3651, 51.3651, 52.01182, 52.01182, 52.01182,
52.01182, 50.114277, 50.114277, 51.43474, 51.43474, 51.10676,
51.10676, 51.10676, 51.10676, 50.435984, 50.435984, 50.435984,
50.435984, 51.78666, 51.78666, 52.441088, 52.441088, 52.552344,
49.259471, 49.259471, 49.259471, 49.259471, 50.461625, 50.461625,
50.461625, 50.461625, 51.746642, 51.746642, 51.746642, 51.746642,
52.2501, 52.2501, 52.2501, 52.2501, 52.423336, 52.423336, 52.423336,
52.423336, 53.615575, 53.615575, 53.615575, 53.615575, 51.08474,
51.08474, 51.08474, 53.19329, 53.19329, 53.19329, 53.19329, 55.96785,
55.96785, 56.52664, 56.52664, 56.52664, 56.52664, 51.8113, 51.8113,
51.8113, 51.8113, 52.580157, 52.580157, 52.580157, 52.580157,
50.52008, 50.52008, 50.52008, 50.52008, 51.48417, 51.48417, 51.48417,
51.48417, 54.58243, 54.58243, 54.58243, 54.58243, 52.58839, 52.58839,
52.58839, 52.58839, 52.717283, 52.717283, 52.717283, 52.717283,
50.740764, 50.740764, 50.740764, 50.740764, 52.57937, 52.57937,
52.57937, 52.57937, 50.736531, 50.736531, 50.79926, 50.79926,
50.79926, 53.675996, 53.675996, 48.35079, 48.35079, 48.35079,
48.35079, 51.36445, 51.36445, 51.36445, 51.36445, 52.122402,
52.122402, 52.122402, 52.16104, 52.16104, 55.91913, 51.6528,
51.6528, 51.6528, 51.6528, 51.88485, 51.88485, 51.88485, 51.88485,
52.34015, 52.34015, 52.34015, 52.026042, 52.026042, 52.026042,
52.026042, 51.319032, 51.319032, 51.319032, 51.319032, 51.51357,
51.51357, 51.51357, 51.51357, 53.43202, 53.43202, 53.43202, 53.43202,
51.50823, 51.50823, 51.50823, 51.50823), Longitude = c(-0.32118,
-0.29293, -0.7078, -0.7078, -0.7078, -0.7078, -1.435407, -1.435407,
-3.210324, -3.210324, 1.33011, 1.33011, 1.33011, 1.33011, -3.67111,
-3.67111, -3.30909, -3.30909, -3.30909, -3.30909, -2.11692, -2.11692,
-2.11692, -2.11692, -2.43155, -3.706923, -3.706923, -1.061008,
-1.061008, -1.061008, -1.061008, -0.65046, -0.65046, -0.65046,
-0.65046, -2.624917, -2.624917, -2.624917, -2.624917, 0.70706,
0.70706, 0.70706, 0.70706, -0.70082, -0.70082, -0.70082, -0.70082,
-5.541128, -5.541128, 0.45981, 0.45981, -2.32071, -2.32071, -2.32071,
-2.32071, -4.105617, -4.105617, -4.105617, -4.105617, -0.71433,
-0.71433, -0.176158, -0.176158, -1.337177, -123.107788, -123.107788,
-123.107788, -123.107788, 3.560973, 3.560973, 3.560973, 3.560973,
0.486416, 0.486416, 0.486416, 0.486416, -0.8825, -0.8825, -0.8825,
-0.8825, -1.787563, -1.787563, -1.787563, -1.787563, -2.432959,
-2.432959, -2.432959, -2.432959, -0.73645, -0.73645, -0.73645,
-0.63793, -0.63793, -0.63793, -0.63793, -3.18084, -3.18084, -3.40313,
-3.40313, -3.40313, -3.40313, -0.22894, -0.22894, -0.22894, -0.22894,
-1.948571, -1.948571, -1.948571, -1.948571, -4.20756, -4.20756,
-4.20756, -4.20756, -0.34854, -0.34854, -0.34854, -0.34854, -5.93229,
-5.93229, -5.93229, -5.93229, -1.96843, -1.96843, -1.96843, -1.96843,
-2.410575, -2.410575, -2.410575, -2.410575, -2.361234, -2.361234,
-2.361234, -2.361234, -1.89325, -1.89325, -1.89325, -1.89325,
-2.011143, -2.011143, -3.19446, -3.19446, -3.19446, -1.272824,
-1.272824, 10.91812, 10.91812, 10.91812, 10.91812, -0.23106,
-0.23106, -0.23106, -0.23106, -0.487443, -0.487443, -0.487443,
0.18702, 0.18702, -3.20987, -1.57361, -1.57361, -1.57361, -1.57361,
-0.17844, -0.17844, -0.17844, -0.17844, -1.27795, -1.27795, -1.27795,
-0.503114, -0.503114, -0.503114, -0.503114, -0.472994, -0.472994,
-0.472994, -0.472994, -3.18738, -3.18738, -3.18738, -3.18738,
-2.27968, -2.27968, -2.27968, -2.27968, -0.25847, -0.25847, -0.25847,
-0.25847), Altitude = c(5L, 0L, 68L, 68L, 68L, 68L, 104L, 104L,
15L, 15L, 23L, 23L, 23L, 23L, 184L, 184L, 176L, 176L, 176L, 176L,
12L, 12L, 12L, 12L, 178L, 36L, 36L, 11L, 11L, 11L, 11L, 210L,
210L, 210L, 210L, 97L, 97L, 97L, 97L, 23L, 23L, 23L, 23L, 0L,
0L, 0L, 0L, 9L, 9L, 4L, 4L, 200L, 200L, 200L, 200L, 160L, 160L,
160L, 160L, 166L, 166L, 0L, 0L, 0L, 47L, 47L, 47L, 47L, 58L,
58L, 58L, 58L, 43L, 43L, 43L, 43L, 97L, 97L, 97L, 97L, 133L,
133L, 133L, 133L, 123L, 123L, 123L, 123L, 128L, 128L, 128L, 15L,
15L, 15L, 15L, 14L, 14L, 65L, 65L, 65L, 65L, 129L, 129L, 129L,
129L, 140L, 140L, 140L, 140L, 18L, 18L, 18L, 18L, 30L, 30L, 30L,
30L, 19L, 19L, 19L, 19L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 96L,
96L, 96L, 96L, 169L, 169L, 169L, 169L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 43L, 43L, 43L, 75L, 75L,
109L, 110L, 110L, 110L, 110L, 95L, 95L, 95L, 95L, 112L, 112L,
112L, 0L, 0L, 0L, 0L, 24L, 24L, 24L, 24L, 38L, 38L, 38L, 38L,
29L, 29L, 29L, 29L, 20L, 20L, 20L, 20L), Species = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "Quercus robur", class = "factor"),
Tree_diameter = c(68.8, 10, 98.5, 97, 32.5, 45.1, 847, 817,
62, 71, 140, 111.4, 114.6, 167.1, 29, 40.1, 68, 45, 60, 54,
104, 122, 85, 71, 81, 39.8, 43.6, 20.1, 17.8, 15.6, 12.1,
81.8, 102.5, 75.5, 57.3, 0.3, 0.2, 0.3, 0.3, 70, 36, 53,
44, 31.5, 27.1, 23.3, 22, 69.4, 37.3, 19.9, 14.6, 196, 122,
118, 180, 58.6, 54.1, 58, 61.5, 58.4, 61, 134, 64, 52.2,
170, 114, 127, 158, 147.4, 135.3, 122.9, 104.1, 263, 237,
322, 302, 175, 182, 141, 155, 89, 41, 70, 83, 141, 86.5,
82, 114.5, 129, 127, 143, 125, 92, 68, 90, 24.5, 20.1, 63.7,
39.8, 66.2, 112.4, 124.5, 94.1, 68.6, 74.4, 23.6, 27.7, 22.9,
25.2, 24.2, 54.7, 43, 33.1, 306, 274, 56, 60, 72.5, 128.5,
22, 16, 143, 103, 53, 130, 48.4, 69.8, 6.4, 18.6, 129.2,
41.7, 57.6, 14, 41.7, 30.2, 39.5, 24.2, 320, 352, 120.9,
108.3, 53.2, 274, 85, 52, 43, 38, 37, 219, 215, 216, 175,
85.9, 49.7, 97.1, 40.8, 62.4, 80.3, 43, 50.3, 28.7, 31.9,
181.5, 149.7, 122, 143.6, 148, 145, 99, 28, 32, 54, 54, 169,
152, 160, 138, 90.8, 87.9, 77.4, 81.2, 91.7, 62.7, 50, 72.9,
23.7, 58, 80.7, 73.7), Urbanisation_index = structure(c(2L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L,
4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 2L, 2L, 2L,
2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 4L, 4L,
4L, 4L, 4L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
4L, 4L, 4L, 4L, 1L, 1L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 2L, 2L, 2L,
2L, 4L, 4L, 2L, 2L, 2L, 3L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 4L, 4L, 1L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L,
4L, 4L, 4L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 1L, 1L, 1L, 1L), .Label = c("1", "2", "3",
"4"), class = "factor"), Stand_density_index = structure(c(3L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 4L, 1L, 1L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 2L, 2L, 4L, 4L, 3L, 3L, 3L, 3L, 4L, 3L,
4L, 4L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L,
2L, 2L, 2L, 2L, 2L, 3L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L,
2L, 2L, 2L, 2L, 3L, 3L, 3L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 4L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 2L, 1L, 1L, 2L,
1L, 1L, 1L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 2L,
3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L), .Label = c("1", "2", "3",
"4"), class = "factor"), Canopy_Index = c(85L, 85L, 85L,
75L, 45L, 25L, 75L, 65L, 75L, 75L, 95L, 95L, 95L, 95L, 95L,
65L, 85L, 65L, 95L, 85L, 85L, 85L, 75L, 75L, 65L, 85L, 85L,
75L, 75L, 85L, 65L, 95L, 85L, 95L, 95L, 75L, 75L, 85L, 85L,
85L, 85L, 85L, 75L, 85L, 85L, 85L, 85L, 75L, 75L, 85L, 85L,
65L, 75L, 85L, 75L, 95L, 95L, 95L, 95L, 75L, 65L, 95L, 95L,
55L, 75L, 65L, 75L, 65L, 85L, 95L, 95L, 75L, 95L, 75L, 95L,
65L, 75L, 75L, 85L, 85L, 65L, 95L, 65L, 65L, 65L, 65L, 65L,
65L, 85L, 85L, 75L, 95L, 85L, 85L, 75L, 45L, 55L, 35L, 35L,
25L, 25L, 95L, 85L, 75L, 85L, 85L, 75L, 75L, 65L, 75L, 85L,
65L, 45L, 95L, 95L, 95L, 95L, 65L, 75L, 45L, 35L, 75L, 95L,
95L, 85L, 75L, 65L, 85L, 95L, 75L, 85L, 85L, 95L, 65L, 65L,
45L, 65L, 85L, 35L, 95L, 85L, 85L, 85L, 85L, 75L, 65L, 65L,
65L, 65L, 55L, 75L, 85L, 85L, 95L, 85L, 75L, 75L, 85L, 65L,
45L, 75L, 75L, 65L, 65L, 75L, 65L, 95L, 95L, 95L, 85L, 65L,
75L, 75L, 75L, 65L, 75L, 35L, 75L, 75L, 75L, 75L, 25L, 45L,
45L, 35L, 85L, 95L, 85L, 95L), Phenological_Index = c(2L,
4L, 2L, 2L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L,
2L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
1L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
4L, 4L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L,
2L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 1L, 3L, 2L, 3L, 3L,
3L, 3L, 4L, 3L, 2L, 3L, 2L, 2L, 2L, 1L, 3L, 1L, 4L, 2L, 4L,
3L, 3L, 3L, 2L, 2L, 2L, 1L, 2L, 3L, 3L, 2L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 4L, 3L, 3L, 3L, 2L, 3L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L)), row.names = c(NA, -189L
), class = "data.frame")
There's no need to create an additional data frame, especially if you don't include the key parameter variables there.
You can try this:
p <- ggplot(QuercusRobur1,
aes(x = Longitude, y = Latitude)) +
geom_polygon(data = UK,
aes(x = long, y = lat, group = group),
inherit.aes = FALSE) +
geom_point() +
coord_map(xlim = c(-10, 5)) + #limits added as there are some points really far away
theme_classic()
p +
aes(color = Urbanisation_index) +
scale_color_discrete(name = "Urbanisation Index",
labels = c("Urban", "Suburban", "Village", "Rural"))
p +
aes(color = Stand_density_index) +
scale_color_discrete(name = "Stand Density Index",
labels = c("Standing alone",
"Within a few trees or close proximity to other trees",
"Within a stand of 10-30 trees",
"Large or woodland"))
p +
aes(color = factor(Phenological_Index)) +
scale_color_discrete(name = "Phenological Index",
labels = c("No indication of autumn timing",
"First autumn tinting",
"Partial autumn tinting (>25% of leaves)",
"Advanced autumn tinting (>75% of leaves)"))
Overview:
I have one dependent variable called 'Tree_diameter', and one independent variable called 'Stand_density_index' (see data frame 1 and 2dbelow).
Stand_density_index contains four categories:
Standing alone
A few trees in close proximity to other trees
Within a stand of 10-20 trees
large stand or woodland
If anyone could please advise which is the correct linear regression approach here:
Method 1
Method 2
Method 3
I would be deeply appreciative.
Overall Aim of the Question:
Using the data from the full database (see data frame 2 below) and the results from an appropriate statistical test, accept or reject the following hypothesis at the 5 % level of significance.
Hypothesis:
H(0): There is no difference in stem diameter of Quercus robur between the different categories of stand density index
From the whole database STATE
The statistical test used - linear regression
The independent (Tree_diameter) and the dependent variable (Stand_density_index)
Justify your conclusion based on this test
Method 1 - constructed with data frame 1
Firstly, I summarised the data frame to find the Mean_Tree_Diameter for each category of the Stand_density_index (see categories above).
Issues:
After I run the linear regression, NA's are being inserted into the results categories.
If anyone can help me understand why I would be deeply appreciative.
##Reformat the vectors correctly
##Stand_density_index = as.factor
Summarised_QuercusRobur1NewData$Stand_density_index<-as.factor(Summarised_QuercusRobur1NewData$Stand_density_index)
##Recheck the structure of the data frame
str(Summarised_QuercusRobur1NewData
##Linear Regression equation
SpeciesStemDensity<-lm(Mean_Tree_Diameter~Stand_density_index, data=Summarised_QuercusRobur1NewData)
##Summary Statistics
summary(SpeciesStemDensity)
##Summary Statistics Results
Method 2 - constructed with data frame 2
In this instance, I used the whole database (see data frame 2) and I reformated 'Stand_density_index' into a factor and run the linear regression model.
##as.factor
##Reformat stand_density_index vector into a categorical vector
QuercusRobur1$Stand_density_index<-as.factor(QuercusRobur1$Stand_density_index)
##Linear Regression
StemDensityStand<-lm(Tree_diameter~Stand_density_index, data=QuercusRobur1)
##Summary Statistics
summary(StemDensityStand)
##Results
Method 3 - Constructed from Data frame 2
I ran the linear regression model with the whole database but the 'Stand_density_index' was numeric.
##as numeric
##Reformat stand_density_index into a categorical vector
QuercusRobur1$Stand_density_index<-as.numeric(QuercusRobur1$Stand_density_index)
##Linear Regression
StemDensityStand<-lm(Tree_diameter~Stand_density_index, data=QuercusRobur1)
##Summary Statistics
summary(StemDensityStand)
##Results
Data frame 1
structure(list(Stand_density_index = structure(1:4, .Label = c("1",
"2", "3", "4"), class = "factor"), Species = structure(c(1L,
1L, 1L, 1L), .Label = "Quercus robur", class = "factor"), Obs_no = c(9L,
82L, 40L, 58L), Mean_Tree_Diameter = c(86.9222222222222, 121.717073170732,
82, 72.4275862068965), SD_Tree_Diameter = c(57.2766046867693,
134.510951231506, 60.202253131019, 61.1575440200358)), row.names = c(NA,
-4L), class = "data.frame")
Data frame 2
structure(list(Obs_.no = c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 19L,
20L, 21L, 22L, 23L, 24L, 25L, 28L, 29L, 30L, 31L, 32L, 33L, 34L,
35L, 36L, 37L, 38L, 39L, 44L, 45L, 46L, 47L, 57L, 58L, 59L, 60L,
61L, 62L, 63L, 64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 74L,
75L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L, 90L, 91L, 93L,
102L, 103L, 104L, 112L, 113L, 114L, 115L, 116L, 117L, 118L, 119L,
120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L, 128L, 129L, 130L,
131L, 135L, 136L, 137L, 138L, 143L, 144L, 145L, 146L, 147L, 148L,
149L, 150L, 151L, 152L, 153L, 154L, 155L, 158L, 159L, 160L, 161L,
162L, 163L, 164L, 165L, 169L, 170L, 171L, 172L, 177L, 178L, 179L,
180L, 181L, 182L, 183L, 184L, 185L, 186L, 187L, 188L, 189L, 190L,
191L, 192L, 193L, 194L, 195L, 196L, 200L, 201L, 202L, 203L, 204L,
205L, 206L, 207L, 208L, 210L, 212L, 214L, 215L, 216L, 217L, 218L,
219L, 220L, 221L, 233L, 234L, 235L, 237L, 239L, 246L, 255L, 256L,
257L, 258L, 260L, 261L, 262L, 263L, 264L, 265L, 266L, 277L, 278L,
279L, 280L, 281L, 282L, 283L, 284L, 285L, 286L, 287L, 288L, 289L,
290L, 291L, 292L, 293L, 294L, 295L, 296L), Date_observed = structure(c(4L,
15L, 6L, 6L, 6L, 6L, 2L, 2L, 8L, 8L, 8L, 8L, 8L, 8L, 6L, 6L,
6L, 6L, 6L, 6L, 11L, 11L, 11L, 11L, 12L, 7L, 7L, 9L, 9L, 9L,
9L, 5L, 5L, 5L, 5L, 14L, 14L, 14L, 14L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 6L, 6L, 5L, 5L, 9L, 9L, 9L, 9L, 3L, 3L, 3L, 3L, 4L, 4L,
1L, 1L, 11L, 6L, 6L, 6L, 6L, 4L, 4L, 4L, 4L, 5L, 5L, 5L, 5L,
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 3L, 3L, 3L, 3L, 11L,
11L, 11L, 4L, 4L, 4L, 4L, 8L, 8L, 10L, 10L, 10L, 10L, 9L, 9L,
9L, 9L, 3L, 3L, 3L, 3L, 9L, 9L, 9L, 9L, 2L, 2L, 2L, 2L, 13L,
13L, 13L, 13L, 8L, 8L, 8L, 8L, 10L, 10L, 10L, 10L, 3L, 3L, 3L,
3L, 13L, 13L, 13L, 13L, 9L, 9L, 10L, 10L, 10L, 2L, 2L, 3L, 3L,
3L, 3L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 5L, 5L, 11L, 9L, 9L, 9L,
9L, 10L, 10L, 10L, 10L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 11L, 11L, 11L, 11L, 6L, 6L, 6L, 6L, 11L, 11L, 11L, 11L), .Label = c("10/1/18",
"10/19/18", "10/20/18", "10/21/18", "10/22/18", "10/23/18", "10/24/18",
"10/25/18", "10/26/18", "10/27/18", "10/28/18", "10/28/19", "10/29/18",
"12/9/18", "8/20/18"), class = "factor"), Latitude = c(51.4175,
52.12087, 52.0269, 52.0269, 52.0269, 52.0269, 52.947709, 52.947709,
51.491811, 51.491811, 52.59925, 52.59925, 52.59925, 52.59925,
51.60157, 51.60157, 52.6888, 52.6888, 52.6888, 52.6888, 50.697802,
50.697802, 50.697802, 50.697802, 53.62417, 50.446841, 50.446841,
53.959679, 53.959679, 53.959679, 53.959679, 51.78375, 51.78375,
51.78375, 51.78375, 51.456965, 51.456965, 51.456965, 51.456965,
51.3651, 51.3651, 51.3651, 51.3651, 52.01182, 52.01182, 52.01182,
52.01182, 50.114277, 50.114277, 51.43474, 51.43474, 51.10676,
51.10676, 51.10676, 51.10676, 50.435984, 50.435984, 50.435984,
50.435984, 51.78666, 51.78666, 52.441088, 52.441088, 52.552344,
49.259471, 49.259471, 49.259471, 49.259471, 50.461625, 50.461625,
50.461625, 50.461625, 51.746642, 51.746642, 51.746642, 51.746642,
52.2501, 52.2501, 52.2501, 52.2501, 52.423336, 52.423336, 52.423336,
52.423336, 53.615575, 53.615575, 53.615575, 53.615575, 51.08474,
51.08474, 51.08474, 53.19329, 53.19329, 53.19329, 53.19329, 55.96785,
55.96785, 56.52664, 56.52664, 56.52664, 56.52664, 51.8113, 51.8113,
51.8113, 51.8113, 52.580157, 52.580157, 52.580157, 52.580157,
50.52008, 50.52008, 50.52008, 50.52008, 51.48417, 51.48417, 51.48417,
51.48417, 54.58243, 54.58243, 54.58243, 54.58243, 52.58839, 52.58839,
52.58839, 52.58839, 52.717283, 52.717283, 52.717283, 52.717283,
50.740764, 50.740764, 50.740764, 50.740764, 52.57937, 52.57937,
52.57937, 52.57937, 50.736531, 50.736531, 50.79926, 50.79926,
50.79926, 53.675996, 53.675996, 48.35079, 48.35079, 48.35079,
48.35079, 51.36445, 51.36445, 51.36445, 51.36445, 52.122402,
52.122402, 52.122402, 52.16104, 52.16104, 55.91913, 51.6528,
51.6528, 51.6528, 51.6528, 51.88485, 51.88485, 51.88485, 51.88485,
52.34015, 52.34015, 52.34015, 52.026042, 52.026042, 52.026042,
52.026042, 51.319032, 51.319032, 51.319032, 51.319032, 51.51357,
51.51357, 51.51357, 51.51357, 53.43202, 53.43202, 53.43202, 53.43202,
51.50823, 51.50823, 51.50823, 51.50823), Longitude = c(-0.32118,
-0.29293, -0.7078, -0.7078, -0.7078, -0.7078, -1.435407, -1.435407,
-3.210324, -3.210324, 1.33011, 1.33011, 1.33011, 1.33011, -3.67111,
-3.67111, -3.30909, -3.30909, -3.30909, -3.30909, -2.11692, -2.11692,
-2.11692, -2.11692, -2.43155, -3.706923, -3.706923, -1.061008,
-1.061008, -1.061008, -1.061008, -0.65046, -0.65046, -0.65046,
-0.65046, -2.624917, -2.624917, -2.624917, -2.624917, 0.70706,
0.70706, 0.70706, 0.70706, -0.70082, -0.70082, -0.70082, -0.70082,
-5.541128, -5.541128, 0.45981, 0.45981, -2.32071, -2.32071, -2.32071,
-2.32071, -4.105617, -4.105617, -4.105617, -4.105617, -0.71433,
-0.71433, -0.176158, -0.176158, -1.337177, -123.107788, -123.107788,
-123.107788, -123.107788, 3.560973, 3.560973, 3.560973, 3.560973,
0.486416, 0.486416, 0.486416, 0.486416, -0.8825, -0.8825, -0.8825,
-0.8825, -1.787563, -1.787563, -1.787563, -1.787563, -2.432959,
-2.432959, -2.432959, -2.432959, -0.73645, -0.73645, -0.73645,
-0.63793, -0.63793, -0.63793, -0.63793, -3.18084, -3.18084, -3.40313,
-3.40313, -3.40313, -3.40313, -0.22894, -0.22894, -0.22894, -0.22894,
-1.948571, -1.948571, -1.948571, -1.948571, -4.20756, -4.20756,
-4.20756, -4.20756, -0.34854, -0.34854, -0.34854, -0.34854, -5.93229,
-5.93229, -5.93229, -5.93229, -1.96843, -1.96843, -1.96843, -1.96843,
-2.410575, -2.410575, -2.410575, -2.410575, -2.361234, -2.361234,
-2.361234, -2.361234, -1.89325, -1.89325, -1.89325, -1.89325,
-2.011143, -2.011143, -3.19446, -3.19446, -3.19446, -1.272824,
-1.272824, 10.91812, 10.91812, 10.91812, 10.91812, -0.23106,
-0.23106, -0.23106, -0.23106, -0.487443, -0.487443, -0.487443,
0.18702, 0.18702, -3.20987, -1.57361, -1.57361, -1.57361, -1.57361,
-0.17844, -0.17844, -0.17844, -0.17844, -1.27795, -1.27795, -1.27795,
-0.503114, -0.503114, -0.503114, -0.503114, -0.472994, -0.472994,
-0.472994, -0.472994, -3.18738, -3.18738, -3.18738, -3.18738,
-2.27968, -2.27968, -2.27968, -2.27968, -0.25847, -0.25847, -0.25847,
-0.25847), Altitude = c(5L, 0L, 68L, 68L, 68L, 68L, 104L, 104L,
15L, 15L, 23L, 23L, 23L, 23L, 184L, 184L, 176L, 176L, 176L, 176L,
12L, 12L, 12L, 12L, 178L, 36L, 36L, 11L, 11L, 11L, 11L, 210L,
210L, 210L, 210L, 97L, 97L, 97L, 97L, 23L, 23L, 23L, 23L, 0L,
0L, 0L, 0L, 9L, 9L, 4L, 4L, 200L, 200L, 200L, 200L, 160L, 160L,
160L, 160L, 166L, 166L, 0L, 0L, 0L, 47L, 47L, 47L, 47L, 58L,
58L, 58L, 58L, 43L, 43L, 43L, 43L, 97L, 97L, 97L, 97L, 133L,
133L, 133L, 133L, 123L, 123L, 123L, 123L, 128L, 128L, 128L, 15L,
15L, 15L, 15L, 14L, 14L, 65L, 65L, 65L, 65L, 129L, 129L, 129L,
129L, 140L, 140L, 140L, 140L, 18L, 18L, 18L, 18L, 30L, 30L, 30L,
30L, 19L, 19L, 19L, 19L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 96L,
96L, 96L, 96L, 169L, 169L, 169L, 169L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 43L, 43L, 43L, 75L, 75L,
109L, 110L, 110L, 110L, 110L, 95L, 95L, 95L, 95L, 112L, 112L,
112L, 0L, 0L, 0L, 0L, 24L, 24L, 24L, 24L, 38L, 38L, 38L, 38L,
29L, 29L, 29L, 29L, 20L, 20L, 20L, 20L), Species = structure(c(1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = "Quercus robur", class = "factor"),
Tree_diameter = c(68.8, 10, 98.5, 97, 32.5, 45.1, 847, 817,
62, 71, 140, 111.4, 114.6, 167.1, 29, 40.1, 68, 45, 60, 54,
104, 122, 85, 71, 81, 39.8, 43.6, 20.1, 17.8, 15.6, 12.1,
81.8, 102.5, 75.5, 57.3, 0.3, 0.2, 0.3, 0.3, 70, 36, 53,
44, 31.5, 27.1, 23.3, 22, 69.4, 37.3, 19.9, 14.6, 196, 122,
118, 180, 58.6, 54.1, 58, 61.5, 58.4, 61, 134, 64, 52.2,
170, 114, 127, 158, 147.4, 135.3, 122.9, 104.1, 263, 237,
322, 302, 175, 182, 141, 155, 89, 41, 70, 83, 141, 86.5,
82, 114.5, 129, 127, 143, 125, 92, 68, 90, 24.5, 20.1, 63.7,
39.8, 66.2, 112.4, 124.5, 94.1, 68.6, 74.4, 23.6, 27.7, 22.9,
25.2, 24.2, 54.7, 43, 33.1, 306, 274, 56, 60, 72.5, 128.5,
22, 16, 143, 103, 53, 130, 48.4, 69.8, 6.4, 18.6, 129.2,
41.7, 57.6, 14, 41.7, 30.2, 39.5, 24.2, 320, 352, 120.9,
108.3, 53.2, 274, 85, 52, 43, 38, 37, 219, 215, 216, 175,
85.9, 49.7, 97.1, 40.8, 62.4, 80.3, 43, 50.3, 28.7, 31.9,
181.5, 149.7, 122, 143.6, 148, 145, 99, 28, 32, 54, 54, 169,
152, 160, 138, 90.8, 87.9, 77.4, 81.2, 91.7, 62.7, 50, 72.9,
23.7, 58, 80.7, 73.7), Urbanisation_index = c(2L, 1L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L,
4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 2L, 2L, 2L, 2L, 4L, 4L,
4L, 4L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 4L,
4L, 4L, 4L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L,
4L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L,
4L, 4L, 1L, 1L, 4L, 4L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 2L, 2L, 2L, 2L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 4L,
4L, 2L, 2L, 2L, 3L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 4L, 4L, 1L, 3L, 3L, 3L, 3L, 1L, 1L, 1L, 1L, 4L, 4L,
4L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 1L, 1L, 1L, 1L), Stand_density_index = c(3, 1, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 4, 4, 4, 2, 2,
2, 2, 4, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2,
2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 4, 4, 3, 3, 3, 3, 4,
3, 4, 4, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 2, 2, 2, 2, 2, 3, 4,
4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 1, 4, 4, 4, 4, 2, 2, 2, 2,
2, 2, 3, 3, 2, 2, 2, 2, 3, 3, 3, 2, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 2, 2, 2, 2, 3, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3,
4, 4, 4, 4, 4, 4, 4, 2, 1, 1, 2, 1, 1, 1, 4, 4, 4, 4, 3,
3, 3, 3, 4, 4, 4, 2, 3, 3, 3, 3, 2, 2, 2, 2), Canopy_Index = c(85L,
85L, 85L, 75L, 45L, 25L, 75L, 65L, 75L, 75L, 95L, 95L, 95L,
95L, 95L, 65L, 85L, 65L, 95L, 85L, 85L, 85L, 75L, 75L, 65L,
85L, 85L, 75L, 75L, 85L, 65L, 95L, 85L, 95L, 95L, 75L, 75L,
85L, 85L, 85L, 85L, 85L, 75L, 85L, 85L, 85L, 85L, 75L, 75L,
85L, 85L, 65L, 75L, 85L, 75L, 95L, 95L, 95L, 95L, 75L, 65L,
95L, 95L, 55L, 75L, 65L, 75L, 65L, 85L, 95L, 95L, 75L, 95L,
75L, 95L, 65L, 75L, 75L, 85L, 85L, 65L, 95L, 65L, 65L, 65L,
65L, 65L, 65L, 85L, 85L, 75L, 95L, 85L, 85L, 75L, 45L, 55L,
35L, 35L, 25L, 25L, 95L, 85L, 75L, 85L, 85L, 75L, 75L, 65L,
75L, 85L, 65L, 45L, 95L, 95L, 95L, 95L, 65L, 75L, 45L, 35L,
75L, 95L, 95L, 85L, 75L, 65L, 85L, 95L, 75L, 85L, 85L, 95L,
65L, 65L, 45L, 65L, 85L, 35L, 95L, 85L, 85L, 85L, 85L, 75L,
65L, 65L, 65L, 65L, 55L, 75L, 85L, 85L, 95L, 85L, 75L, 75L,
85L, 65L, 45L, 75L, 75L, 65L, 65L, 75L, 65L, 95L, 95L, 95L,
85L, 65L, 75L, 75L, 75L, 65L, 75L, 35L, 75L, 75L, 75L, 75L,
25L, 45L, 45L, 35L, 85L, 95L, 85L, 95L), Phenological_Index = c(2L,
4L, 2L, 2L, 4L, 4L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L,
2L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L,
1L, 2L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 3L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
4L, 4L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 1L, 1L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 3L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L,
2L, 2L, 2L, 2L, 3L, 3L, 3L, 4L, 4L, 3L, 3L, 3L, 3L, 3L, 3L,
3L, 3L, 3L, 3L, 3L, 3L, 4L, 1L, 1L, 1L, 1L, 3L, 2L, 3L, 3L,
3L, 3L, 4L, 3L, 2L, 3L, 2L, 2L, 2L, 1L, 3L, 1L, 4L, 2L, 4L,
3L, 3L, 3L, 2L, 2L, 2L, 1L, 2L, 3L, 3L, 2L, 3L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 4L, 3L, 3L, 3L, 2L, 3L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 3L, 2L)), row.names = c(NA, -189L
), class = "data.frame")
Alice!
The issue with you linear regression model is that you do not have enough data to perform a linear regression.
Because you have one dependent variable to explain each independent variable, you no need a model, just four equations with four variables to resolve.
That is why the intercept is equal to the Mean_Tree_Diameter for Stand_density_index==1 , intercept + Stand_density_index_2 equal to Mean_Tree_Diameter for Stand_density_index==2... Also, that is why your Multiple R Squared is 1. Your model is perfect!
So, either you do not use Stand_density_index in you model or you include more data (several values of Mean_Tree_Diameter for the same Mean_Tree_Diameter) or you will always get this results.
If you try your model with this data:
Summarised_QuercusRobur1NewData<-structure(list(Stand_density_index = structure(c(1,1,2,2), .Label = c("1",
"2"), class = "factor"), Species = structure(c(1L,
1L, 1L, 1L), .Label = "Quercus robur", class = "factor"), Obs_no = c(9L,
82L, 40L, 58L), Mean_Tree_Diameter = c(86.9222222222222, 121.717073170732,
82, 72.4275862068965), SD_Tree_Diameter = c(57.2766046867693,
134.510951231506, 60.202253131019, 61.1575440200358)), row.names = c(NA,
-4L), class = "data.frame")
You will get some results, because now you have 4 different independent variable results for only 2 different dependent variables.
I have a dataset of barnacle density and coral cover by photo from two coral reef locations. I want to see if there is a pattern in barnacle density with depth or coral cover.
I have tried linear models and a negative binomial with the formula
m2 <- glm.nb(dens.cm ~ depth + coral.cover+location+depth:location, data =data)
However, after looking at a distribution of the density data with depth, I think a Gaussian function may better explain the patterns.
Density of barnacles per m2 by depth (m) and location
I am looking for advice on how to design a Gaussian model for my data in R. Any advice is appreciated!
> dput(dat)
structure(list(photo = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L,
8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L,
21L, 22L, 23L, 24L, 25L, 26L, 27L, 28L, 29L, 30L, 31L, 32L, 33L,
34L, 35L, 36L, 37L, 38L, 39L, 40L, 41L, 42L, 43L, 44L, 45L, 46L,
47L, 48L, 49L, 95L, 96L, 97L, 98L, 99L, 100L, 101L, 102L, 103L,
104L, 105L, 106L, 107L, 108L, 109L, 110L, 111L, 112L, 113L, 50L,
51L, 52L, 53L, 54L, 55L, 56L, 57L, 58L, 59L, 60L, 61L, 62L, 63L,
64L, 65L, 66L, 67L, 68L, 69L, 70L, 71L, 72L, 73L, 74L, 75L, 76L,
77L, 78L, 79L, 80L, 81L, 82L, 83L, 84L, 85L, 86L, 87L, 88L, 89L,
90L, 91L, 92L, 93L, 94L, 114L, 115L, 116L, 117L, 118L, 119L,
120L, 121L, 122L, 123L, 124L, 125L, 126L, 127L, 128L, 129L, 130L,
131L, 132L, 133L, 134L), .Label = c("101", "102", "103", "104",
"105", "106", "107", "108", "201", "202", "203", "204", "205",
"206", "207", "208", "209", "210", "211", "212", "301", "302",
"303", "304", "305", "306", "307", "501", "502", "503", "504",
"505", "506", "507", "508", "509", "510", "511", "512", "513",
"601", "602", "603", "604", "605", "606", "607", "608", "609",
"6157", "6173", "6177", "6178", "6181", "6182", "6199", "6201",
"6202", "6203", "6210", "6211", "6214", "6222", "6237", "6241",
"6245", "6256", "6260", "6261", "6296", "6297", "6299", "6302",
"6304", "6308", "6309", "6311", "6312", "6313", "6314", "6315",
"6320", "6322", "6323", "6324", "6325", "6326", "6327", "6328",
"6329", "6424", "6426", "6428", "6431", "701", "702", "703",
"704", "705", "706", "707", "708", "709", "801", "802", "803",
"804", "805", "806", "807", "808", "809", "810", "D01", "D02",
"D03", "D04", "D05", "D06", "D07", "D08", "D10", "D11", "D12",
"D13", "D14", "D15", "D16", "D17", "D18", "D19", "D20", "D21",
"D22"), class = "factor"), location = structure(c(1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L,
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 1L, 1L,
1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L,
1L, 1L, 1L), .Label = c("fgb", "usvi"), class = "factor"), depth = c(19.5072,
19.812, 21.5, 20.7264, 21.336, 19.5072, 19.812, 20.0312, 21.9456,
23.4696, 23.4696, 24.0792, 23.1648, 23.4696, 21.336, 19.5072,
20.1168, 20.7264, 21.0312, 21.0312, 21.9456, 20.4216, 19.5072,
21.0312, 22.2504, 21.9456, 20.4216, 20.4216, 20.4216, 21.336,
20.7264, 20.7264, 20.4216, 20.4216, 19.812, 20.1168, 20.1168,
20.7264, 19.812, 21.9456, 22.86, 22.2504, 21.9456, 22.5552, 22.2504,
21.0312, 21.336, 21.336, 21.6408, 23.4696, 23.7744, 21.9456,
22.2504, 22.2504, 21.6408, 22.2504, 22.2504, 21.5, 23.1648, 22.5552,
22.2504, 22.5552, 22.2504, 21.9456, 21.85, 22.2504, 24.0792,
22.2504, 15, 15, 15, 15, 15, 15, 13, 13, 13, 13, 13, 13, 13,
21, 21, 21, 21, 7, 7, 7, 32, 32, 32, 32, 32, 32, 32, 32, 32,
32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 38, 38, 38, 38,
32.6992, 29.5656, 31.0896, 31.0896, 32.6136, 33.8328, 35.3568,
35.3568, 31.0896, 37.7952, 29.5656, 31.0896, 31.0896, 32.6136,
33.8328, 35.3568, 35.3568, 36.8808, 37.7952, 37.7952, 38.1),
dens.m = c(267.86719, 350.47852, 431.81125, 622.71004, 599.24271,
1420.18674, 193.38521, 161.44909, 910.49021, 110.35386, 479.12616,
408.42407, 315.60503, 74.8805, 104.48846, 137.99029, 469.71577,
356.37609, 950.49046, 272.49611, 528.00183, 269.93556, 480.50256,
118.2897, 185.00516, 438.49583, 276.08897, 227.43988, 86.33476,
185.46051, 84.80511, 451.02732, 400.5159, 163.67933, 90.92022,
137.38598, 202.10666, 159.44588, 197.77431, 453.77111, 101.17702,
134.19122, 122.93134, 429.97449, 430.17319, 1153.40396, 214.65884,
1342.54685, 578.08208, 578.44438, 252.6739, 2174.60653, 354.51124,
340.84014, 390.41988, 244.08631, 806.81267, 651.94004, 57.84774,
303.84401, 411.5247, 555.01574, 118.71732, 94.01832, 572.41467,
444.28938, 123.78678, 320.6036361, 0, 0, 49.41053235, 0,
125.6693464, 0, 93.84212658, 198.2007337, 327.6507767, 907.6881184,
0, 239.4739237, 0, 0, 443.5415909, 0, 51.88753895, 401.7879564,
0, 428.9613238, 0, 17.05628117, 0, 0, 0, 62.93519689, 0,
14.42007124, 0, 0, 0, 52.11494159, 0, 0, 0, 0, 0, 0, 0, 10.83275387,
141.8632389, 0, 0, 0, 0, 446.919281, 132.8611692, 143.198051,
33.05694578, 167.1561242, 51.78159277, 99.97872, 75.88997,
502.1027409, 354.7612359, 18.01753245, 59.73474983, 101.6708376,
192.2764503, 279.5383788, 138.1696187, 289.6458105, 166.5402349,
65.25117077, 649.1753683, 346.42269), coral.cover = c(28.52606,
11.05908, 31.28802, 28.91658, 3.54822, 12.18002, 16.72137,
1.92059, 23.42574, 64.22509, 37.25867, 48.04682, 58.10703,
36.08555, 45.99744, 67.4129, 41.21151, 53.32379, 14.54049,
40.63984, 57.09064, 42.2561, 39.77932, 23.7793, 35.67588,
28.4876, 35.53832, 21.61865, 35.1461, 14.45028, 45.70443,
52.544, 53.58537, 27.60442, 16.56497, 6.12609, 31.23248,
48.8958, 25.30934, 40.41436, 28.02014, 36.47627, 28.28651,
13.44436, 25.07424, 38.02122, 49.11345, 7.12683, 24.52069,
15.27754, 35.67601, 8.35171, 1.87428, 6.0433, 20.08231, 13.70174,
39.39322, 9.61437, 10.3376, 50.15105, 37.62041, 39.14767,
41.23067, 38.1632, 46.12196, 16.10196, 36.32152, 44.90422,
2.0575, 12.13155, 5.20272, 5.34756, 4.0912, 0.60427, 5.47876,
1.29702, 0.78458, 0.56643, 0.75587, 2.14695, 8.99664, 0.73209,
1.15917, 1.40533, 4.95436, 0.63981, 1.03059, 1.19857, 0.38732,
60.28733, 25.67675, 10.33979, 13.07546, 4.08467, 6.10119,
35.65439, 5.54589, 15.93534, 6.06176, 9.86548, 7.00005, 21.27449,
12.13181, 26.65331, 5.83493, 14.69534, 6.87034, 23.73075,
7.24837, 1.58201, 2.56882, 0.35245, 20.23897, 42.96672, 44.67648,
28.76856, 37.52041, 40.01538, 4.705, 29.9067, 30.06042, 7.45481,
14.35932, 8.60488, 16.68506, 23.30932, 14.51399, 33.59438,
38.95256, 43.35688, 2.65983, 9.84355, 37.1201, 50.76407)), .Names = c("photo",
"location", "depth", "dens.m", "coral.cover"), class = "data.frame", row.names = c(NA,
-134L))