Displaying 20 results from an estimated 5000 matches similar to: "How can I get "predict.lm" results with manual calculations ? (a floating point problem)"
2007 Jun 10
3
find position
find the position of the first value who equals certain number in a vector:
Say a=c(0,0,0,0,0.2, 0.2, 0.4,0.4,0.5)
i wish to return the index value in a for which the value in the vector is
equal to 0.4 for the first time. in this case, it is 7.
[[alternative HTML version deleted]]
2008 Mar 05
2
matrix inversion using solve() and matrices containing large/small values
Hello
I've stumbled upon a problem for inversion of a matrix with large values,
and I haven't found a solution yet... I wondered if someone could give a
hand. (It is about automatic optimisation of a calibration process, which
involves the inverse of the information matrix)
code:
*********************
> macht=0.8698965
> coeff=1.106836*10^(-8)
>
2009 Mar 16
4
Match .3 in a sequence
Hello:I am trying to match the value 0.3 in the sequence seq(.2,.3). I get
> 0.3 %in% seq(from=.2,to=.3)
[1] FALSE
Yet
> 0.3 %in% c(.2,.3)
[1] TRUE
For arbitrary sequences, this "invisible .3" has been problematic. What is
the best way to work around this?
Thank you.
Dan
[[alternative HTML version deleted]]
2009 Jun 19
1
cut with floating point, a bug?
With floating point numbers I'm seeing 'cut' putting values in the wrong
bands. An example below places 0.3 in (0.3,0.6] i.e. 0.3 > 0.3.
> x = 1:5*.1
> x
[1] 0.1 0.2 0.3 0.4 0.5
> cut(x, br=c(0,.3,.6))
[1] (0,0.3] (0,0.3] (0.3,0.6] (0.3,0.6] (0.3,0.6]
Levels: (0,0.3] (0.3,0.6]
I'm sure this is probably the same issue documented in the FAQ (7.31 Why
doesn't R
2006 Dec 09
2
Floating point maths in R
Hi,
I am not sure if this is just me using R (R-2.3.1 and R-2.4.0) in the
wrong way or if there is a more serious bug. I was having problems
getting some calculations to add up so I ran the following tests:
> (2.34567 - 2.00000) == 0.34567 <------- should be true
[1] FALSE
> (2.23-2.00) == 0.23 <------- should be true
[1] FALSE
> 4-2==2
[1] TRUE
> (4-2)==2
[1] TRUE
>
2011 Mar 04
4
Floating points and floor() ?
Perhaps somebody could clarify for me if the following is a floating
point matter or otherwise, and how am I to correct for it?
> floor(100*.1)
[1] 10
> 100*(1.0-.9)
[1] 10
> floor(100*(1-0.9))
[1] 9
Thanks!
Michael
_______________________________________________________
Michael Folkes
Salmon Stock Assessment
Canadian Dept. of Fisheries & Oceans
Pacific Biological Station
2008 Aug 11
3
Peoblem with nls and try
Hello,
I can`t figure out how can increase the velocity of the fitting data by nls.
I have a long data .csv
I want to read evry time the first colunm to the other colunm and analisy with thata tools
setwd("C:/dati")
a<-read.table("Normalizzazione.csv", sep=",", dec=".", header=F)
for (i in 1:dim(a[[2]]]) {
#preparazione dati da analizzare
2008 Aug 18
1
"nested" getInitial calls; variable scoping problems
Hi All,
Another nls related problem (for background, I'm migrating a complicated
modelling package from S-plus to R).
Below I've reduced this to the minimum necessary to demonstrate my problem
(I think); the real situation is more complicated.
Two similar selfStart functions, ssA and ssB.
The 'initial' function for ssB modifies its arguments a little and then
calls getInital
2010 Nov 16
2
Integrating functions / vector arithmetic
Hello,
I was trying to build some functions which I would like to integrate over an
interval using the function 'integrate' from the 'stats' package. As an
example, please consider the function
h(u)=sin(pi*u) + sqrt(2)*sin(pi*2*u) + sqrt(3)*sin(pi*3*u) + 2*sin(pi*4*u)
Two alternative ways to 'build' this function are as in f and g below:
coeff<-sqrt(1:4)
2010 Oct 17
4
Variable name as string
Hello,
from Verzani, simpleR (pdf), p. 80, I created the following function to
test the coefficient of lm() against an arbitrary value.
coeff.test <- function(lm.result, var, coeffname, value) {
# null hypothesis: coeff = value
# alternative hypothesis: coeff != value
es <- resid(lm.result)
coeff <- (coefficients(lm.result))[[coeffname]]
# degrees of freedom = length(var) -
2011 Feb 08
4
Interactions in a nls model
I am interested in testing two similar nls models to determine if the
lines are statistically different when fitted with two different data
sets; one corn, another soybean. I know I can do this in linear models
by testing for interactions. See Introductory Statistics with R by
Dallgaard p212-218 for an example. I have two different data sets I am
comparing to lai. ci.re should have very
2001 Aug 31
2
contrasts in lm
I've been playing around with contrasts in lm by specifying the contrasts
argument. So, I want to specify a specific contrast to be tested
Say:
> y _ rnorm(100)
> x _ cut(rnorm(100, mean=y, sd=0.25),c(-3,-1.5,0,1.5,3))
> reg _ lm(y ~ x, contrasts=list(x=c(1,0,0,-1)))
> coef(reg)[2]
x1
-1.814101
I was surprised to see that I get a different estimate for the
2018 Jul 10
9
[PATCH 0/7] PowerPC64 performance improvements
The following series adds initial vector support for PowerPC64.
On POWER9, flac --best is about 3.3x faster.
Amitay Isaacs (2):
Add m4 macro to check for C __attribute__ features
Check if compiler supports target attribute on ppc64
Anton Blanchard (5):
configure.ac: Remove SPE detection code
configure.ac: Add VSX enable/disable
configure.ac: Fix FLAC__CPU_PPC on little endian, and add
2010 May 24
1
retrieve path analysis coefficients (package agricolae)
Dear list,
I'd like to use path.analysis in the package agricolae in batch format on
many files, retrieving the path coefficients for each run and appending them
to a table. I don't see any posts in the help files about this package or
the path.analysis package. I've tried creating an object out of the call to
path.analysis, but no matter what I try, the function automatically prints
2010 Nov 03
2
memory allocation problem
Hi R users
I am trying to run a non linear parameter optimization using the
function optim() and I have problems regarding memory allocation.
My data are in a dataframe with 9 columns. There are 656100 rows.
>head(org_results)
comb.id p H1 H2 Range Rep no.steps dist aver.hab.amount
1 1 0.1 0 0 1 100 0
0.2528321
2004 Oct 22
3
Convert a list in a dataframe
Hi,
I've a list containing parameters (intercepts &
coefficients) of 12 regressions fitted
> coeff
[[1]]
(Intercept) anno
-427017.1740 217.0588
[[2]]
(Intercept) anno
-39625.82146 21.78025
.....
[[12]]
(Intercept) anno
257605.0343 -129.7646
I want create a data frame with two columns (intercept
and anno)using data in these list.
Any help
2008 Oct 15
1
Parameter estimates from an ANCOVA
Hi all,
This is probably going to come off as unnecessary (and show my ignorance)
but I am trying to understand the parameter estimates I am getting from R
when doing an ANCOVA. Basically, I am accustomed to the estimate for the
categorical variable being equivalent to the respective cell means minus the
grand mean. I know is the case in JMP - all other estimates from these data
match the
2007 Feb 19
3
summary polr
Hi all,
I have a problem to estimate Std. Error and t-value by ?polr? in library Mass.
They result from the summary of a polr object.
I can obtain them working in the R environment with the following statements:
temp <- polr(formula = formula1, data = data1)
coeff <- summary(temp),
but when the above statements are enclosed in a function, summary reports the following error:
2006 Aug 21
4
question about 'coef' method and fitted_value calculation
Dear all,
I am trying to calculate the fitted values using a ridge model
(lm.ridge(), MASS library). Since the predict() does not work for lm.ridge
object, I want to get the fitted_value from the coefficients information.
The following are the codes I use:
fit = lm.ridge(myY~myX,lambda=lamb,scales=F,coef=T)
coeff = fit$coef
However, it seems that "coeff" (or "fit$coef") is
2006 Oct 04
1
strip function
Hi,
I would like to asign titles into strip of a panel of curves designed
thanks to a xyplot function (lattice package)
I ve tried the "strip" function, ...
here is my code
I would like to write in the strip of each panel conditionning varialbe
(here, it is data[,1])
xyplot (data[,3] ~ data[,2] | data[,1] , strip.default (which.given=1,
which.panel = c(1:15), var.name= c