estimating join points in segmented taper model

46 views
Skip to first unread message

Phil Radtke

unread,
Aug 6, 2012, 1:41:15 PM8/6/12
to for...@googlegroups.com
Hello Forest-Rs, 

Can anyone tell me how to estimate break/join points of a segmented taper function (maybe using nls?). I'm trying to estimate join points alpha1 and alpha2 that connect model segments following Mahadev Sharma's model (8) in Forest Science 49(2):324. 
With my code below, all I get is a "singular gradient" error message. :(

-Phil

(data set "strub.dat" attached)

# R-script ###################################################
# read data for the Mike Strub 2012 Challenge
pt <- read.table(file="strub.dat",header=TRUE)
pt$x <- pt$h/pt$HT
pt$y <- (pt$d/pt$DBH)^2

# Join point definitions coded as binary indicators
i1 <- function(x,alpha) { ifelse(x >= alpha,1.0,0) }
i2 <- function(x,alpha) { ifelse(x < alpha,1.0,0) }
i3 <- function(x,alpha) { ifelse(x < alpha,1.0,0) } 

# model 8 from Sharma & Burkhart (For Sci 49(2): pg324)
fit <- nls(y ~ (a1*(x-1) + a2*(x^2-1))*i1(x,alpha1) + 
  a4*(alpha1-x)^2*i2(x,alpha1) + a6*(alpha2-x)^2*i3(x,alpha2),
data=pt,start=list(a1=-3.3, a2=1.6, a4=-1.7, a6=41,alpha1=0.75,alpha2=0.1))
# end R-script ###################################################

Thanks!

strub.dat
Reply all
Reply to author
Forward
0 new messages