0
R에서 minpack.lm 패키지를 사용하려고합니다. 특히 NLS.LM 기능. 매뉴얼과 도움말 파일을 쏟아 부었지만, 설정에 필요한 요구 사항은 현재의 능력을 약간 상회합니다. 모든 지침을 크게 주시면 감사하겠습니다. 여기에 내 코드와 아래에있는 오류 진술이 나와 있습니다.minpack.lm 패키지에서 NLS.LM 사용에 관한 질문
R 코드 :
Error in function (par) : could not find function "fn"
가 어떻게 설정 파에 필요합니까 : 여기
# Thomas P. Taggart
# ERE445/645
# Spring 2013 - Calibration Presentation
# Lumped parameter rainfall-runoff model for the Susquehanna River at Conklin, NY.
# Outlined in Haith's (1987) GWLF model. The model uses the SCS curve
# number runoff technique to determine runoff, with snowpack, unsaturated zone, and
# saturated zone mass balances. Evapotranspiration is to be determined using Hamon’s
# method with average monthly values for daylight hours.
# In this model we assume the following constants, which are determined through calibration:
# Baseflow Recession Coefficient, Kb
# Field capacity, FCAP
# Curve number for average moisture conditions, CN2
# Initial antecedent moisture conditions, iAMC
# Initial snow accumulation, iSNt
# Initial saturated zone storage, iSATt
# No deep groundwater seepage
# including needed functions
source("Functions.R")
source("distributionFunctions.R")
source("GWLF_Model.R")
require(ggplot2)
require(reshape)
library(minpack.lm)
library(scales)
###############################################################################################
# USGS Discharge data for Conklin, NY - Gage on the Susquehanna
# Reading in the input file
dischargeInput <- read.csv("USGS_DailyDischarge_ConklinNY_01503000_A.csv", header=TRUE)
###############################################################################################
# Weather Data
# Read in input file
weatherInput = read.csv("Conklin_NY_WeatherData_Edit.csv")
###############################################################################################
# Setting up the model inputs - inital Run
# Baseflow Recession, Kb
Kb <- 0.90
# Initial unsaturated storage is at field capacity, FCAP (cm)
FCAP <- 10
# Curve number for average moisture conditions, CN
CN <- 65.7
# Initial antecedent moisture conditions, AMC
AMC <- 1.5
# Initial saturated zone storage, SATt
iSATt <- 0.45
# Snowmelt constant, K
K <- 0.45
parameters <- c(Kb, FCAP,CN, AMC, iSATt, K)
# Calling the Model - 1st time to see the initial outputs
# GWLF(parameters, dischargeInput, weatherInput)
###############################################################################################
# Calibrating the model
guess <- c("Kb"=0.1, "FCAP"=1,"CN"=50, "AMC"=0, "iSATt"=0, "K"=0.5)
out <- nls.lm(par = guess, fn = GWLF(parameters, dischargeInput, weatherInput))
오류 메시지가 무엇입니까? 또는 함수의 첫 번째 인수는 nls.lm 내에서 호출하고 있습니까? GWLf 함수가 함수에서 상수로 사용되는 6 개의 매개 변수를 전달 중입니다. 이들은 내가 교정하기를 희망하는 6 가지 매개 변수입니다. ?nls.lm
을 읽는에서
감사합니다, 톰
MNEL, 와우 !! 몇 분 전만해도 제대로 작동하고있어. 정확히 작동시키는 법이야. 정확하게. 나는 두 번째 반복 후에 왜 내 반복이 멈추는 지 궁금해하는 문제에 직면했다는 것을 알고있다. (심지어 그래프의 숫자가 두 번의 반복보다 높을 것임을 알았다고 생각한다.) 그리고 결과로 나오는 파 출력이 초기보다 전혀 다르지 않은 이유는 무엇인가? 추측 값. – traggatmot
@traggatmot, 재현 할 수있는 예제를 제공 할 수 없다면 도움이 될 것입니다. – mnel