best_migramod: Select best migramod model.

Description Usage Arguments Value Examples

View source: R/best_migramod.R

Description

One solution to initial values problem based on the generaton of a random sample with size equals one from uniform apriori distributions with values between 0 and 1 for the initial parameters.

Usage

1
2
best_migramod(dataIn = dataIn, model.rc, profile = "eleven", maxite = 100,
  epsilon = 1e-05, datasimul = T)

Arguments

dataIn

Standarized migration data set for optimization.

model.rc

a Object of class Migramod.

profile

Number of parameters of a Roger and Castro model.

maxiter

Maximum number of iterations for model optimization.

Value

a list with named parameters

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
require(migraR)
require(dplyr)
data("es_asmr")
data1 <- es_asmr[-c(1,2),c(1,5)]
colnames(data1) <- c("x","y")
attach(data1)
model.rc.13 = MigraModel(
  name = 'castro_13',
  expr = rc_expression(profile = "thirteen")
)

model.rc.7 = MigraModel(
  name = 'castro_7',
  expr = rc_expression(profile = "seven")
)
model.rc.11 = MigraModel(
  name = 'castro_11',
  expr = rc_expression(profile = "eleven")
)

plot(data1, cex=0.1, xlab = 'Age', ylab = 'Standarized Migration Rate')
fitted.val.11 <- best_migramod(dataIn = data1, model.rc =model.rc.11, maxite = 5E2, profile = "eleven")
lines(data1[,1], model.rc.11$value(fitted.val.11$bestParam,data1), col="blue", lty=3)
fitted.val.7 <- best_migramod(dataIn = data1, model.rc =model.rc.7, maxite = 5E2, profile = "seven")
lines(data1[,1], model.rc.7$value(fitted.val.7$bestParam,data1), col="blue")
fitted.val.13 <- best_migramod(dataIn = data1, model.rc =model.rc.13, maxite = 5E2, profile = "thirteen")
lines(data1[,1], model.rc.13$value(fitted.val.13$bestParam,data1), col="green")
legend("topright",legend = c("seven","eleven","thirteen"),fill = c("red","blue","green"))

elflacosebas/migraR documentation built on July 18, 2018, 9:12 a.m.