Return of the original scale in a prediction function [closed]

2

I created a simple function to predict tree heights using regression models constructed for this purpose (hypsometric relation models). The function predicts heights and inserts them into a new column in the data.frame by merging them with the heights used to fit the model, but some hypsometric relationship models alter the original height scale (response variable), as for example models that use log. Is there any way to make the predict (for example) function return the values in the original scale, identifying the scaling factor in the model?

The function is as follows:

pp <-           
  function(model,data)
  { 
{
  vetor <- data[is.na(data$AltMed),]        
  vetor <- predict (model,vetor)    

  data$ALTMISTA <- data$AltMed          
  data$ALTMISTA[is.na(data$ALTMISTA)] <- vetor
}

return (data)       
}

The template I'm encountering, are as follows:

modelo 1 = lm(log(Altura) ~ I(1/Dap) + log(AlturaD), data=data)

modelo 2 = nls(I(Altura/AlturaD) ~ a1*(1-a2*exp(-a3*I(Dap/Q))), data=data, start=list(a1=3.348296, a2=-11.675862, a3=1.88852))

These models change the scale of the response variable.

    
asked by anonymous 07.01.2015 / 18:42

0 answers