[R] boot: how is t0 calculated?

2012-10-22 Thread Thomas Hoffmann

Dear all,

I am doing log-transformed bootstrap regression using:

x=c(0.038,0.054,1.030,1.250,10.240,52.000,228.100,240.000,758.000,1502.600,0.140,9.170,280.000,1.000,0.150,0.388,20)
y=c(3961.5,25987.5,526557,321094.5,642,23592715.5,4050,
228853521.1,320980392,42900,58435.5,13525240.5,621195600,102,30567.0,296100.0,480)

xy = data.frame(x=x,y=y)

reg.ln = function(storage, indices){
  storage = storage[indices,]
  res.lm  = lm(log(y)~log(x), data=storage)
  coefficients(res.lm)
}

xy.boot = boot(xy, reg.ln, 2000)



Why does the Intercept given by xy.boot$t0 differs from 
mean(co.boot$t[,1])?

How are the t0 values calculated?

Any help is appreciated!

Thanks
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] calculate RMSE using bootstrap

2012-10-15 Thread Thomas Hoffmann

Dear all,

I need to calculate confidence intervals of a and b and root mean square 
error (RMSE) of a power law given by


Y = a X^b

I calculate the confidence intervals by:

reg.ln = function(tab.xy, indices){
tab.xy = storage[indices,]
res.lm  = lm(log(y)~log(x), data=tab.xy)
coefficients(res.lm)
}

xy.boot = boot(tab.xy, reg.ln, 2000)

boot.ci(xy.boot)

where tab.xy is a dataframe containing x and y.

Is there any way to calculate the mean RMSE of the 2000 fitted models, 
e.g. identify the data which are not used in the random sub-sample 
generated by boot() and calculate the RMSE of the fitted models.



Kind regards for any help
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] fitting power growth

2012-07-10 Thread Thomas Hoffmann

Dear all

I am using the x and y vectors as defined below and want do to a power 
law regression:


y = a x^b

using
> lm(log(y)~log(x))

gives reasonable values (b=1.23) but is not very popular due to biases 
of back-transformation from log to non-log values.  Using


> nls(y~a*x^b,start=list(a=100,b=1.23))

is statistically more correct but gives a too large "a" value and a too 
small "b" value.



Doe anybody have a better way to solve the above power-law regression 
(using for instance maximum likely hood or anything else).


Kind regards for your help
Thomas



> x
 [1]   744.90   806.40   838.00   910.70  1818.60  2870.10  4070.00 
4476.80  4857.60  4858.10
[11]  5916.40 13970.80 27306.60 28226.60  2532.10  2658.40 18863.10   
758.0054.0079.00
[21]   139.0046.70  1003.0024.00   106.00   186.00 1503.00   
228.0010.24   162.00

[31]   381.70   312.60   209.00   246.00   221.20  1151.55
> y
 [1] 1.500e+08 2.850e+08 1.800e+08 1.800e+08 6.300e+08 7.200e+08 
1.170e+09 1.095e+09 1.620e+09
[10] 4.650e+09 1.575e+09 4.200e+09 7.755e+09 8.745e+09 9.900e+08 
6.600e+08 1.077e+10 3.450e+08
[19] 1.350e+07 2.550e+07 6.600e+07 6.000e+06 3.300e+07 1.500e+06 
4.500e+06 7.500e+06 2.415e+08
[28] 6.900e+07 9.000e+05 9.450e+06 3.510e+07 4.880e+07 3.100e+06 
1.930e+07 2.270e+07 5.270e+07


__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] help with expression

2012-03-14 Thread Thomas Hoffmann
Hi all,

I still fail to plot an axis title with the following expression:

plot(0,xlab=expression('(SOC [' * kgm^{-2} * '])' * ^{-2}))

the xlab should look like:   (SOC [kgm^2])^0.25

with an out bracket and a superscript.


Thanks for your advice.

Thomas


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] determing font type in expression

2008-07-22 Thread Thomas Hoffmann

Dear R-Maillist members,

I would like to label the y-axis of a plot with a mathematical 
expression "sed.rate mm a-1", where the "-1" is printed subscript. I am 
using font.lab=15 for the x-axis. However, when plotting the y-axis with 
the expression-function it appears in a different font. Does anybody 
knows how to use font.lab=15 in the expression as well?


Cheers
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] creating expression with for-loop

2008-04-09 Thread Thomas Hoffmann
Dear listmembers

I would like to create an expression that looks like

labl = expression(10^1,10^2,10^3,10^4,10^5)

using a for-loop. However

for (i in 1:5){ labl[i]=expression(10^i) }

does not do the right thing. Does anybody knows help?


Thanks
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] filled.contour with log axis

2008-02-16 Thread Thomas Hoffmann
Dear all,

I would like to generate a filled.contour plot with log x and y axis, 
however using:

filled.contour(as.line,log="xy")

results in a warning message.


Does anybody knos what to do?

Thanks
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] axis names in triangle.plot

2007-12-18 Thread Thomas Hoffmann
Thanks for this advice.

grain was not a data.frame but a matrix. Now it works:-)

Cheers
Thomas


Stéphane Dray schrieb:
> Hi Thomas,
> This looks quite strange. By default, the function use the column 
> names as labels.
> What is grain ? A data.frame ? Why have you duplicated row.names? 
> Please return the results of class(grain) and names(grain)
>
> Cheers,
> PS: If you have questions related to ade4, you can use the adelist 
> (http://listes.univ-lyon1.fr/wws/info/adelist)
>
>
> Thomas Hoffmann wrote:
>> Hi folks,
>>
>> I am using a data.frame with sediment grain sizes:
>>
>>  > grain
>>  sand  silt  clay
>> OAT 10.03 56.77 18.25
>> OAT 10.40 57.40 17.94
>> WG1 50.03 20.68 12.57
>> WG1 43.20 25.69 13.41
>> WG1 33.89 31.10 14.48
>> WG2  2.84 62.81 20.79
>> WG2  2.79 60.46 19.16
>> WG2 16.27 33.04  6.48
>> WG2  1.39 57.90  9.13
>> WG3  4.54 52.91 17.20
>> WG3  5.20 50.55 15.65
>> WG3  7.71 49.13 10.80
>> WG3  4.43 50.03 11.83
>> WG3  1.72 57.53 14.20
>> WG3  1.51 58.99 13.96
>>
>> I would like to do a trinagle.plot with labeled axis-names "sand" 
>> "silt" and "clay". However using the command:
>>
>> tringle.plot(grain)
>>
>> from ade4-apckage) does not plot the axis names and there is no 
>> paramter to set the labels like "xlab" in the plot command. Does 
>> anybody has a good advice?
>>
>> Thanks in advance
>> Thomas
>>
>> __
>> R-help@r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide 
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>>
>>   
>
>

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] axis names in triangle.plot

2007-12-18 Thread Thomas Hoffmann
Hi folks,

I am using a data.frame with sediment grain sizes:

 > grain
 sand  silt  clay
OAT 10.03 56.77 18.25
OAT 10.40 57.40 17.94
WG1 50.03 20.68 12.57
WG1 43.20 25.69 13.41
WG1 33.89 31.10 14.48
WG2  2.84 62.81 20.79
WG2  2.79 60.46 19.16
WG2 16.27 33.04  6.48
WG2  1.39 57.90  9.13
WG3  4.54 52.91 17.20
WG3  5.20 50.55 15.65
WG3  7.71 49.13 10.80
WG3  4.43 50.03 11.83
WG3  1.72 57.53 14.20
WG3  1.51 58.99 13.96

I would like to do a trinagle.plot with labeled axis-names "sand" "silt" 
and "clay". However using the command:

tringle.plot(grain)

from ade4-apckage) does not plot the axis names and there is no paramter 
to set the labels like "xlab" in the plot command. Does anybody has a 
good advice?

Thanks in advance
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] fit to power law with inknown zero

2007-10-18 Thread Thomas Hoffmann
Dear R-helpers

I would like to do a fit of the form: y = a (x+c)**b, where a, b and c 
are unknown.

Does anybody know how to do it?

Thanks
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] power law fit with unknown zero

2007-10-17 Thread Thomas Hoffmann
Dear R-helpers

I would like to do a fit of the form: y = a (x+c)**b, where a, b and c 
are unknown.

Does anybody know how to do it?

Thanks
Thomas

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.