Displaying 20 results from an estimated 200 matches similar to: "Question about syntax in lm function"
2003 Sep 22
2
ksmooth in SPLUS vs R
I am working with a model that I have to estimate a nonparametric
function. The model is partial linear i.e.
Y=X$\beta$ + f(z) + $\epsilon$
I am using the ' double residual methods' Robinson (1988) Speckman (1988)
where I estimate a nonparametric function for each of the parametric
variables in terms of the nonparametric one i.e.
X[,i]=g(Z)+ u
this is done because I need the $E(
2003 Sep 23
0
ANOVA(L, Terms...)
Hi There
I have a lm object with 4 parameters and I want to test wether 2 parameters
are equal using a Wald test (basically b1=b2 or b1-b2 =0). In the help file
from R it says that under ANOVA the optional arguments " Terms" or "L" test
whether a linear combination is equal to 0. I tried;
>anova(m1, Terms = Beta1-Beta2=0) but I get the error:
Object " Beta1"
2011 Nov 03
1
Question about Calculation of Cross Product
The function of crossprod in R puzzled me.
I would like to calculate the cross product of two vectors. According to my text book, it defines like this:
a = (ax, ay, az)
b = (bx, by, bz)
then, the cross product of a and b is:
a X b = (ay*bz-az*by, az*bx-ax*bz, ax*by-ay*bz)
It can also write in a determinant format.
But the crossprod or tcrossprod function in R appeared not calculate the cross
2011 Sep 25
2
help about R basic
This is my first time to ask for help in the R mailing list, so sorry for my misbehavior.
The question is actually an example of the apply function embedded in R. Code is here:
> x <- cbind(x1 = 3, x2 = c(4:1, 2:5)) > dimnames(x)[[1]] <- letters[1:8] > x x1 x2 a 3 4 b 3 3 c 3 2 d 3 1 e 3 2 f 3 3 g 3 4 h 3 5 > cave <- function(x, c1, c2) c(mean(x[c1]),
2019 Feb 14
0
Proposed speedup of spec.pgram from spectrum.R
Hello,
I propose two small changes to spec.pgram to get modest speedup when
dealing with input (x) having multiple columns. With plot = FALSE, I
commonly see ~10-20% speedup, for a two column input matrix and the speedup
increases for more columns with a maximum close to 45%. In the function as
it currently exists, only the upper right triangle of pgram is necessary
and pgram is not returned by
2007 Nov 25
1
spec.pgram() - circularity of kernel
Hi,
I am far from experienced in both R and time series hence the question.
The code for spec.pgram() seems to involve a circularity of the kernel (see
below) yielding new power estimates to all frequencies computed by FFT.
"
if (!is.null(kernel)) {
for (i in 1:ncol(x)) for (j in 1:ncol(x)) pgram[, i,
j] <- kernapply(pgram[, i, j], kernel, circular = TRUE)
2020 Oct 19
1
spec.pgram returns different spectra when fast=TRUE and the number of samples is odd
Dear all,
This is potentially a bug in spec.pgram, when the number of samples is odd,spec.pgramreturns a different result withfast = TRUE, the example below contains the two varieties with a reference spectrum calculated manually. the number of returned spectra is also larger (50 compared to 49) whenfast = TRUE
x <- rnorm(
99
)
plot(spec.pgram(x, taper =
0
, detrend =
FALSE
, plot =
2004 Jan 22
1
spectrum
Dear R users
I have two questions about estimating the spectral power of a
time series:
1) I came across a funny thing with the following code:
data(co2)
par(mfrow=c(2,1))
co2.sp1<-spectrum(co2,detrend=T,demean=T,span=3)
co2.sp2<-spectrum(co2[1:468],detrend=T,demean=T,span=3)
The first plot displays the frequencies ranging from 0 to 6
whearas the second plot displays the same curve but
2018 Feb 09
0
Information
Hi
Copy your messages to r help, others may give you better advice.
Strange, I do not get such error. Beside, from
m = t(matrix(data = detrend, nrow = 30))
I expect matrix result, but your str shows that m is list.
> m<-list(a=rep(NA, 20), b=rep(1,20))
> colMeans(m, na.rm=T)
Error in colMeans(m, na.rm = T) :
'x' must be an array of at least two dimensions
So as colMeans help
2009 May 14
1
corrupted smoothing kernel ?
I am trying to use the "kernel" function. To understand how it works I tried out some of the examples.
None of them works as shown in the following:
> kernel("daniell", 50) #
Error in kernel("daniell", 50) : unused argument(s) (50)
> kernel("daniell", 10) #
Error in kernel("daniell", 10) : unused argument(s) (10)
>
2008 Aug 05
4
LIDAR Problem in R (THANKS for HELP)
Hi All,
I am a PhD student in forestry science and I am working with LiDAR data set
(huge data set). I am a brand-new in R and geostatistic (SORRY, my
background it?s in forestry) but I wish improve my skill for improve myself.
I wish to develop a methodology to processing a large data-set of points
(typical in LiDAR) but there is a problem with memory. I had created a
subsample data-base but
2007 Dec 14
1
Help! - boxcox transformations
Hi,
Hope this does not sound too ignorant .
I am trying to detrend and transform variables to achieve normality and
stationarity (for time series use, namely spectral analysis). I am using the
boxcox transformations.
As my dataset contains zeros, I found I need to add a constant to it in
order to run "boxcox". I have ran tests adding several types of constants,
from .0001
2003 Jun 03
1
tseries "adf.test"
I have a question regarding the adf.test command in the tseries library.
I have a vector of time series observations (2265 daily log prices for the
OEX to be exact). I also have this same data in first-differenced form. I
want to test both vectors individually for staionarity with an Augmented
Dickey-Fuller test. I noticed when I use the adf.test command from the
tseries library, the general
2009 Jul 08
0
typo in ts detrending implementation in spec.pgram?
Hello!
I wonder if there is a typo in detrending code of spec.pgram in spectrum.R from stats package.
One can see in the code https://svn.r-project.org/R/trunk/src/library/stats/R/spectrum.R .
I am afraid there is a typo and the code should look like
if (detrend) {
t <- 1L:N - (N + 1)/2
sumt2 <- N * (N^2 - 1)/12
for (i in 1L:ncol(x))
x[, i] <- x[, i] -
2008 Jun 04
2
estimate phase shift between two signals
Hi,
Are there any functions in R that could be used to estimate the phase-shift
between two semi-sinusoidal vectors? Here is what I have tried so far, using
the spectrum() function -- possibly incorrectly:
# generate some fake data, normalized to unit circle
x <- jitter(seq(-2*pi, 2*pi, by=0.1), amount=pi/8)
# functions defining two out-of-phase phenomena
f1 <- function(x)
2018 Feb 08
2
Information
I have a time series of 1095 data corresponding to a daily data of three years.
I want to know how to use ma(timeserie, order=??, centre=??) to detect the trend:
which order is suitable and what is the difference between centre= true or false.
How to avoid these errors:
1-Error in timeserie - trend :
? argument non num?rique pour un op?rateur binaire="non-numeric argument for a binary
2008 Apr 30
3
Cross Spectrum Analysis
I am reading some documentation about Cross Spectrum Analysis as a technique
to compare spectra.
My understanding is that it estimates the correlation strength between
quasi-periodic structures embedded in two signals. I believe it may be
useful for my signals analysis.
I was referred to the R functions that implement this type of analysis. I
tried all the examples which generated a series of
2008 Oct 02
0
spec.pgram help?
Hopefully this will not seem too ignorant of a question. I am having a hard time picking out the sources of the differences between:
abs(fft(x))^2/length(x)
and
spec.pgram(x, taper=0, log="no", plot=FALSE)
Also from the limited testing that I have done since the DC "frequency" is not returned from spec.pgram how can I tell what has happened to the series when I specify
2006 Jan 24
0
Relating Spectral Density to Chi-Square distribution
Dear list,
I had some confusion regarding what function too use in order too relate
results from spec.pgram() too a chi-square distribution. The documentation
indicates that the PSD estimate can be approximated by a chi-square
distribution with 2 degrees of freedom, but I am having trouble figuring out
how to do it in R, and figuring out what specifically that statement in the
documentation
2010 Jan 21
0
Using spec.ls to interpolate very long time series
I have an very long, irregularly spaced time series (and I'm also new to
spectral analysis, so please be patient.) I want to use spec.ls as an
interpolator and then use the output to reconstruct the time series via
inverse fft. But so far I've been having difficulty doing this.
ts<-read.csv("timeseries.csv",header=TRUE) #file contains over 30000
irregularly spaced