Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask History Expert

Problem 1: From ourMoodel site, Run the lines provided at the very bottom of the code working with the skull data and compare it to the output on pages 65 and 66. Run the command two more times using Euclidean and Mahalanobis distances. Put all three distance matrices into your lab report where you rounding to three significant figures. (1a.) Provide a paragraph of commentary on the distances with respect to the data. (2b.)Carefully look at the provided R code. Tell me what two commands are new to you. Research these two new commands and in your own words explain to me what they do.

Distances based on proportions

Ex 1. When there is NO overlap of classes:

 

Type 1

Type 2

Type 3

Colony 1 proportions

0.7

0.3

0.0

Colony 2 proportions

0

0

1.0

1115_dissimilarity index.pngThis is called the dissimilarity index.

833_similarity index.png, and this is called the similarity index.

Another index:

2042_similarity_index_1.png

 

Ex 2. When there is a complete overlap of classes:

 

Type 1

Type 2

Type 3

Colony 1 proportions

0.7

0.3

0.0

Colony 2 proportions

0.7

0.3

0.0

2337_distance measure.png

* In other cases these indices have values between 0 and 1.

* Similarity measures are often constructed as 1/D or 1/(1+D), where D = distance measure.

Problem 2:(2a.) Create a function that returns both the results of equation 5.5 and 5.6. (Use the list( ) command as done in the distmatrix( ) function.) Input should be two vectors p1 and p2 which represent the proportions for each species and each sum to 1. Comment your code.(2b.) Show your data for three different scenarios: No overlap, complete overlap, and partial overlap.

For problem 2a, use the following code to help you.
dissimilarity<- function(p1,p2)

{

Your code here

return( list(d1=d1, d2=d2) ) # returning list of both indices

}

Presence-absence data

(Table 5.5 on text p. 68)

Site

1

2

3

4

5

6

7

8

9

10

Species 1

0

0

1

1

1

0

1

1

1

0

Species 2

1

1

1

1

0

0

0

0

1

1

Summary:

 

Species 2

 

 

Species 1

present

absent

TOTAL

present

a (=3)

b (=3)

a + b

absent

c (=3)

d (=1)

c + d

TOTAL

a + c

b + d

n

Similarity measures(all vary between 0 (=no similarity) and 1 (=complete similarity)):

• Simple matching index: (a+d)/n

• Ochiai index:

936_Ochiai index.png

• Dice-Sorensen index: 2a/(2a+b+c)

• Jaccard index: a/(a+b+c)

Problem 3:(3a.) Create a function that returns a list containing all four indices shown above (and on page 68). The input should be four values: PP,AP,PA,AA which match with a, b, c, and d. Comment your code.(3b.) Run your function for the three scenarios: (1) 0's for AP and PA, but non-zero values for PP and AA; (2) 0's for PP and AA, but non-zero values for PA and AP; (3) some blend between scenarios (1) and (2).

The following commands may help you:

sp1 <- c(0,1,0,1,1,0,1,1,0,0,0,1)

sp2 <- c(1,1,1,1,0,0,0,0,1,1,1,1)

table(sp1,sp2)

PresAbsIndex<- function(PP,PA,AP,AA)

{

[ Your code goes here ]

}

Problem 4:Install the package "ade4" followed by data(butterfly) to get the butterfly dataset described on pages 7 and 8 of our text. Our question is: "Is genetic similarity correlated with geographic distances between butterfly colonies?" Repeat the below code and fill in the genetic distance matrix using the distance measure we called d1 in problem 2. (Don't worry about using percentages rather than proportions, the relative distances end up just being 0-100 instead of 0-1.) Perform a Mantel Randomization test and interpret the results. Repeat the test using the measure of distance d2. Did it make a difference? Start off with the below R code to help you. (Show your for-loop code as part of your answer as well as the scatter plots and randomization plots from the Mantel Randomization tests.)

library(ade4)

data(butterfly)

names(butterfly)

help(butterfly)

help(pch)

help(polygon)

help(segments)

plot(butterfly$contour[,1:2], pch=16, cex=.4) # set up x and y limits for graph

#segments(x0=butterfly$contour[,1],y0=butterfly$contour[,2],

# x1=butterfly$contour[,3],y1=butterfly$contour[,4])

polygon(butterfly$contour[,1:2], lty=2) # does same as segments()

points(butterfly$xy, pch=7)

nrow(butterfly$xy)

text(butterfly$xy, labels=1:16, pos=2, cex=.8)

apply(butterfly$genet,1,sum) # confirming rows add to 100

(Ddist<- dist(butterfly$xy))

dissimilarity(butterfly$genet[1,],butterfly$genet[2,])$d2 # testing it out

Dgenet<- matrix(NA,nrow=16,ncol=16)

[Your code, consisting of two nested for-loops, to fill in Dgenetmatrix . Use the function you created in problem 2.]

Dgenet # to see what matrix now looks like

Dgenet<- as.dist(Dgenet)

plot(Ddist,Dgenet)

cor(Ddist, Dgenet)

(mantel.out<- mantel.rtest(Dgenet,Ddist, nrepet=10000))

plot(mantel.out).

History, Academics

  • Category:- History
  • Reference No.:- M91295558
  • Price:- $20

Guranteed 24 Hours Delivery, In Price:- $20

Have any Question?


Related Questions in History

So my professor asked us to program a stick figure in

So my professor asked us to program a "stick figure" in python turtle, which I did but my program is not working. He wants us to repeat and/or randomize elements from the current "stick figure" program which I don't know ...

The tobacco industry is a prime example to consider when

The tobacco industry is a prime example to consider when talking about price elasticity of demand. While nicotine use can be addictive for many users, it is not addictive for the so-called "social smokers". What can we s ...

List an organization that you believe has recently

List an organization that you believe has recently undertaken a proactive change. List an organization that you believe has recently undertaken a reactive change. For these questions below, consider a past or current wor ...

The powerpoint presentation must be on a topic pertinent to

The PowerPoint Presentation must be on a topic pertinent to this course, integrating two humanities disciplines. The PowerPoint must be 6-8 slides in length (not counting a bibliography slide). You will compare two cultu ...

The following is used to define an array of student names

The following is used to define an array of student names. var [ Sara, Ali, Lincoln, Jack] Develop a JavaScript function to sort above array and display the sorted array in an HTML element.

Propose a changein your initial discussion post this week

Propose a Change In your initial discussion post this week present an argument that proposes one change to our electoral system. (Please note, it will not be acceptable to say you do not think any change should be made.) ...

Question explain how social movements affect democracy and

Question : Explain how social movements affect democracy, and how women's movement and the civil rights movement have affected democracy. (Use outside sources plus textbook: please remember to cite sources) 260 words

Answer the questions to all three examples for full

Answer the questions to all three examples for full credit. Chapter 8 1. "Whole Lotta Love" by Led Zeppelin is based on a riff. What is the song form and how does this dissection help analyze how the song is performed? W ...

The purpose of this assignment is to view alvin aileys

The purpose of this assignment is to view Alvin Ailey's iconic choreography "Revelations" and identify themes expressed in the work that reflect life events/emotions. Dance comes from life, as we have been exploring in c ...

Responseaurelius augustine was born in north africa in 354

Response Aurelius Augustine was born in North Africa, in 354. He converted to Christianity in 387, and ordained to Bishop in 395 (Lawall, Thalmann and Patterson 1113). Aurelius Augustine directly talks to God in the lite ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As