User Tools

Site Tools


population_assignment_test

Population assignment test

  • file: points_assignmentTest.r
  • document page: 24


code:

#----read data--------------------------------------------------------------
sample1 <- read.table("D:/Heidi/Master/R_Daten/assignmentTest/sample1.txt", 
				skip=3 ) 
sample2 <- read.table("D:/Heidi/Master/R_Daten/assignmentTest/sample2.txt", 
				skip=3 )
  
sample1 <- as.matrix(sample1[2:3])
sample2 <- as.matrix(sample2[2:3])

min_x <- min(sample1[,1], sample2[,1])
min_y <- min(sample1[,2], sample2[,2])

#----draw plot--------------------------------------------------------------
op <- par(mar=c(2,2,6,5))
  plot(sample1, col="blue", pch=21, xlim=c(min_x, 0), ylim=c(min_y, 0), 
		xlab="", ylab="", axes=FALSE)
    points(sample2, col="red", pch=22)
    lines(c(min_x, 0), c(min_y ,0))
  
    legend("topleft", c("Population 1", "Population 2"), bty="n",
            col=c("blue", "red"), pch=c(21,22))
    axis(side=3, cex.axis=0.8)
    axis(side=4, cex.axis=0.8)
    mtext("Population assignment test", side=3, line=3.5, font=2, cex=1.5)
    mtext("Log(L(Population 1))", side=3 , line=2, font=2)
    mtext("Log(L(Population 2))", side=4 , line=2, font=2)
    box()

#---- At end of plotting, reset to previous par settings:----
par(op)
population_assignment_test.txt · Last modified: 2008/07/22 13:31 by 127.0.0.1