Boris Steipe boris.steipe at utoronto.ca
Wed Apr 19 22:16:10 CEST 2017

```What about the advice I sent you this morning?

B.

> On Apr 19, 2017, at 1:49 PM, Boris Steipe <boris.steipe at utoronto.ca> wrote:
>
> No attachments please. Use the dput() function. And keep the correspondence on the list, there are many colleagues who are far more knowledgeable than I am.
>
> Cheers,
> Boris
>
>
>
>
>> On Apr 19, 2017, at 1:47 PM, Santiago Bueno <swbueno at gmail.com> wrote:
>>
>> Thanks a lot Mr. Steipe. I have attached to this email an Excel file with 48 observations.  The problem is that when I try to get the prediction plot for the following model:
>> start <- coef (lm(log(Btot)~I(log(dbh**2*haut)),data=dat[dat\$Btot>0,]))
>> start[1] <- exp(start[1])
>> names(start) <- c("a","b")
>> model18 <- nls(Btot~a*(dbh**2*haut)**b,data=dat,start=start,weights=1/dat\$dbh**4)
>> summary(model18)
>>
>> using this code:
>>
>> with(dat,plot(dbh**2*haut,Btot,xlab="dbh^2*H(cm^2.m)",ylab="Biomass (t)", pch=19))
>> D <- seq(0,180,length=20)
>> H <- seq(0,61,length=20)
>>
>> abline(model18, lwd=3)
>>
>> I get the data points but not the prediction line (see below)
>>
>> <image.png>
>> If you can help me in getting this line, I will be eternaly grateful..
>>
>> Best regards,
>>
>> Santiago Bueno
>>
>> On Wed, Apr 19, 2017 at 12:20 PM, Boris Steipe <boris.steipe at utoronto.ca> wrote:
>> Can you provide a small reproducible example and explain what exactly is going wrong?
>>
>> Just a handful of data points will do.
>>
>>
>> B.
>>
>>
>>
>>> On Apr 18, 2017, at 2:16 PM, Santiago Bueno <swbueno at gmail.com> wrote:
>>>
>>> Thanks Boris, the following is an extract of my data. I have developed
>>> biomass models using codes like:
>>>
>>> start <- coef (lm(log(Btot)~I(log(dbh**2*haut)),data=dat[dat\$Btot>0,]))
>>>
>>> start[1] <- exp(start[1])
>>>
>>> names(start) <- c("a","b")
>>>
>>> M1 <- nls(Btot~a*(dbh**2*haut)**b,data=dat,start=start,weights=1/dat\$dbh**4)
>>>
>>>
>>> start <- coef(lm(log(Btot)~I(log(dbh))+I(log(haut)),data=dat[dat\$Btot>0,]))
>>>
>>> start[1] <- exp(start[1])
>>>
>>> names(start) <- c("a","b1","b2")
>>>
>>> M2 <- nls(Btot~a*dbh**b1*haut**b2,data=dat,start=start,weights=1/dat\$dbh**4)
>>>
>>>
>>> Tree No dbh haut Btot
>>> 1 35.00 18.90 0.535
>>> 2 25.00 16.60 0.248
>>> 3 23.00 19.50 0.228
>>> 4 13.50 15.60 0.080
>>> 5 20.00 18.80 0.172
>>> 6 23.00 17.40 0.190
>>> 7 29.00 19.90 0.559
>>> 8 17.60 18.20 0.117
>>> 9 31.00 25.30 0.645
>>> 10 26.00 23.50 0.394
>>> 11 13.00 13.00 0.038
>>> 12 32.00 20.70 0.443
>>> It is my interest to get prediction plots for the models. I have tried to
>>> use the following codes with no success: Let m be one of the fitted models
>>> with dbh as the only entry. To construct a plot of the predictions made by
>>> this model I have tried:
>>> with(dat,plot(dbh,Btot,xlab="Dbh(cm)",ylab="Biomass (t)"))
>>> D <- seq(par("usr")[1],par("usr")[2],length=200)
>>> lines(D,predict(m,newdata=data.frame(dbh=D)),col="red")
>>> For a model m that has dbh and height as entries, I have tried to get its
>>> predictions as follows:
>>> D <- seq(0,180,length=20)
>>> H <- seq(0,61,length=20)
>>> B <- matrix(predict(m,newdata=expand.grid(dbh=D,height=H)),length(D))
>>>
>>> Can someone provide help please!!!
>>>
>>>
>>> Best regards,
>>>
>>> Santiago Bueno
>>>
>>>      [[alternative HTML version deleted]]
>>>
>>> ______________________________________________
>>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>>> https://stat.ethz.ch/mailman/listinfo/r-help
>>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>> <Biomasa_Total.xls>
>

> On Apr 19, 2017, at 4:13 PM, Ista Zahn <istazahn at gmail.com> wrote:
>
> For help in formulating your question in a way that makes it easy to
>
> When asking for help on the R-help mailing list in particular, make
> sure to send plain-text email.
>
> Best,
> Ista
>
> On Wed, Apr 19, 2017 at 3:56 PM, Santiago Bueno <swbueno at gmail.com> wrote:
>> I have tried to ask for help ragarding R software but it seems that I do
>> not know how to send my questions. Can someone "PLEASE" tutor me on how to
>> structure my messages?
>>
>> Best regards,
>>
>> Santiago
>>
>>        [[alternative HTML version deleted]]
>>
>> ______________________________________________
>> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help