R
Datum: Maandag 20 februari @ 17:12:07 GMT+1
Onderwerp: Software


De afgelopen week heb ik geworsteld met R, de gratis en open source software voor statistisch onderzoek, om een begin te maken met een overgang van het commerciele en drakonische SPSS... Maar dat valt natuurlijk niet mee! R is een taal -en scriptomgeving, het heeft geen menu-gestuurde interface.

Mijn eerste R-doel is om de uitvoer van mijn software voor syntactische metingen als R data frames te kunnen benaderen. Hiervoor gebruik ik mede de iL04 interface van Peter Kleiweg.

Dit is nog werk in uitvoering, maar mijn toolchain genereert al een enigzins werkend R-script voor ieder metingsresultaat waarmee ik in R kan verder experimenteren, zoals je hier kunt zien...

# Ask the user for input before a new figure is drawn
oldInteractiveValue <- par(ask = TRUE)

# Include RuG/L04 import functions
library(iL04)

# Read distance table
sand1.b.dif <- read.dif("D:/DOCUME~1/Marco/pro/dat/../../out/sand1.b/sand1.b.dif")
# Read 3D-vector after Classical MDS
sand1.b.vec <- read.vec("D:/DOCUME~1/Marco/pro/dat/../../out/sand1.b/vec/sand1.b.cl.vec")
# Read longitude/latitude coordinates of datapoints
sand1.b.coo <- read.table("D:/DOCUME~1/Marco/pro/dat/../../out/sand1.b/sand1.b.coo", 
	header = FALSE, sep ="	", quote = "", dec = ".", row.names = NULL, 
	c("Longitude", "Latitude", "dx", "dy", "Location") )
# Read longitude/latitude border lines of the Dutch language area
sand1.b.map <- read.table("D:/DOCUME~1/Marco/pro/dat/nl.map.R", header = FALSE, sep = " ", 
	quote = "", dec = ".", row.names = NULL, c("Longitude", "Latitude") )

# Calculate the mean aspect ratio for the range of latitudes
aspectRatio <- mean.asp(sand1.b.map[, 2])

# Create a distance-frequency histogram
hist(sand1.b.dif)
# Plot the empirical cumulative distribution
plot(ecdf(sand1.b.dif), do.points = FALSE, verticals = TRUE)

# Plot a clustering-based partitioning on a topographic map
clustermap(sand1.b.coo[, 1:2], sand1.b.dif, labels = sand1.b.coo$Location, 
	method="ward", k = 4, cex = 0.3, bwlim=0.55, seq = 25:1, asp = aspectRatio, 
	map = sand1.b.map, xlab="Longitude", ylab="Latitude")

# Perform classical (Metric) Multidimensional Scaling on the distance matrix
sand1.b.mds <- cmdscale(sand1.b.dif, 2)
# Generic plotting of the MDS solution in 3 dimensions
plot(sand1.b.mds, type = "n", xlab = "", ylab = "", main = "Classical MDS solution in 3 dimensions")
text(sand1.b.mds, rownames(sand1.b.mds), cex = 0.3)
# Plot the results of 3D multidimensional scaling on a topographic map
mdsmap(sand1.b.coo[, 1:2], sand1.b.mds, labels = sand1.b.coo$Location, 
       main = "3D MDS on a topographic map", asp = aspectRatio, map = sand1.b.map)
# Plot a stochastic clustering on a topographic map
cccmap(sand1.b.coo[, 1:2], sand1.b.dif, labels = sand1.b.coo$Location, 
       main = "Repeated clustering + 3D MDS", asp = aspectRatio, map = sand1.b.map)
# Plot a set of links on a topographic map
linkmap(sand1.b.coo[, 1:2], sand1.b.dif, labels = sand1.b.coo$Location, 
        main = "Differences represented as lines", nmax = 600, limit = .2, 
		separate = 20, asp = aspectRatio, map = sand1.b.map)

# Restore the user interactivity input value
par(oldInteractiveValue)






Dit artikel komt van marco@work
http://marco.info/pro

De URL voor dit verhaal is:
http://marco.info/pro/modules.php?name=News&file=article&sid=157