Displaying 20 results from an estimated 600 matches similar to: "predict.lm - standard error of predicted means?"
2011 Mar 12
2
Identifying unique pairs
Dear R helpers
Suppose I have a data frame as given below
mydat = data.frame(x = c(1,1,1, 2, 2, 2, 2, 2, 5, 5, 6), y = c(10, 10, 10, 8, 8, 8, 7, 7, 2, 2, 4))
mydat
x y
1 1 10
2 1 10
3 1 10
4 2 8
5 2 8
6 2 8
7 2 7
8 2 7
9 5 2
10 5 2
11 6 4
unique(mydat$x) will give me 1,
2009 Aug 12
3
Obtaining the value of x at a given value of y in a smooth.spline object
I have some data fit to a smooth.spline object as follows: (x=vector of data
for the predictor variable, y=vector of data for the response variable)
fit <- smooth.spline(x,y)
Now, given a spline fit point y_new, I want to be able to find out what
value of x_new yielded this fit value. How to do so?
(This problem is the inverse of the predict.smooth.spline function, which
takes x_new as input
2007 Nov 07
1
thumbnailer/swfdec-thumbnailer.c
thumbnailer/swfdec-thumbnailer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
New commits:
commit a31d0686b78df2da96b9d8d1e3220e63978bba30
Author: Benjamin Otte <otte at gnome.org>
Date: Wed Nov 7 20:02:04 2007 +0100
s/swfdec_player_get_image_size/swfdec_player_get_default_size/
diff --git a/thumbnailer/swfdec-thumbnailer.c b/thumbnailer/swfdec-thumbnailer.c
index
2013 Feb 12
3
improving/speeding up a very large, slow simulation
Dear R help;
I'll preface this by saying that the example I've provided below is pretty
long, turgid, and otherwise a deep dive into a series of functions I wrote
for a simulation study. It is, however, reproducible and self-contained.
I'm trying to do my first simulation study that's quite big, and so I'll
say that the output of this simulation as I'd like it to be is
2005 Feb 16
2
R: ridge regression
hi all
a technical question for those bright statisticians.
my question involves ridge regression.
definition:
n=sample size of a data set
X is the matrix of data with , say p variables
Y is the y matrix i.e the response variable
Z(i,j) = ( X(i,j)- xbar(j) / [ (n-1)^0.5* std(x(j))]
Y_new(i)=( Y(i)- ybar(j) ) / [ (n-1)^0.5* std(Y(i))] (note that i have
scaled the Y matrix as well)
k is
2008 Mar 25
3
derivatives in R
Hi, I posted this message earlier in "Rmetrics" and I don't know whether I
posted in the wrong place, so I'm posting it again in Rhelp.
I have a function in x and y and let's call it f(x,y). I need to get the
Hessian matrix. i.e I need (d^2f/dx^2), (d^2f/dxdy), (d^2f/dydx),
(d^2f/dy^2).I can get these using the D function. now I need to evaluste the
hessian matrix for
2008 Apr 17
1
Finding a path using the Graph package
Hello,
Does anyone know of a way of finding all the nodes that are between a pair
of specified nodes in the excellent graph package (R vers 2.5.0).
I have a class(graphAM) object and need to determine all possible pathways
in this object.
Here's an example: In the simple case of a--b--c (where -- denotes
"conected to") the list of all pathways would be: ab ba abc cba cb bc.
2013 May 04
2
Lasso Regression error
Hi all,
I have a data set containing variables LOSS, GDP, HPI and UE.
(I have attached it in case it is required).
Having renamed the variables as l,g,h and u, I wish to run a Lasso
Regression with l as the dependent variable and all the other 3 as the
independent variables.
data=read.table("data.txt", header=T)
l=data$LOSS
h=data$HPI
u=data$UE
g=data$GDP
matrix=data.frame(l,g,h,u)
2007 Oct 17
1
y_hat
Hello,
suppose one has the following values
x1 <- rnorm(10,5,1)
x2 <- rgamma(10,5,1)
y <- rnorm(10,4,1)
mydat <- data.frame(y,x1,x2)
then one can use glm like
mod <- glm(y~x1+x2, data=mydat, family=gaussian)
But how could I estimate y_hat?
Thanks alot!
Sam
---------------------------------
[[alternative HTML version deleted]]
2009 Feb 19
1
matrix computation???
Hello
Can anyone tell me what I am doing wrong below? My Y and y_hat are the same.
A<-scale(stackloss)
n1<- dim(A)[1];n2<-dim(A)[2]
X<-svd(A)
Y<- matrix(A[,"stack.loss"],nrow=n1)
Y
y_hat <-matrix((X$u%*% t(X$u))%*%Y,nrow=n1,byrow=T)
y_hat
[[alternative HTML version deleted]]
2009 Apr 07
6
Sequences
Hi,
I am trying to make a sequence and am using a for loop for this. I want to
start off with an initial value ie S[0]=0 then use the loop to create other
values. This is what I have so far but I just keep getting error messages.
#To calculate the culmulative sums:
s<-rep(0,207) #as this is the length of the
vector I know I will have
s<-as.vector(s)
2001 Oct 16
4
two way ANOVA with unequal sample sizes
Hi,
I am trying a two way anova with unequal sample sizes but results are not
as expected:
I take the example from Applied Linear Statistical Models (Neter et al.
pp889-897, 1996)
growth rate gender bone development
1.4 1 1
2.4 1 1
2.2 1 1
2.4 1 2
2.1 2 1
1.7 2 1
2.5 2 2
1.8 2 2
2 2 2
0.7 3 1
1.1 3 1
0.5 3 2
0.9 3 2
1.3 3 2
expected results are
2023 Jan 26
1
Failing to install the rgl package
Hi,
I try to execute the seven lines of code below to plot a graph. But I
am failing as the messages below show. Where am I going wrong?
install.packages("rgl")
library(rgl)
y_hat = X%*%B_hat
open3d(windowRect = c(100,100,900,900),family = "serif")
color = rainbow(length(y_hat))[rank(y_hat)]
plot3d(educ,exper,wage,col = color,type = "s",size = 0.5,xlim =
2010 Jun 23
1
Estimate of variance and prediction for multiple linear regression
Hi, everyone,
Night. I have three questions about multiple linear regression in R.
Q1:
y=rnorm(10,mean=5)
x1=rnorm(10,mean=2)
x2=rnorm(10)
lin=lm(y~x1+x2)
summary(lin)
## In the summary, 'Residual standard error: 1.017 on 7 degrees of freedom',
1.017 is the estimate of the constance variance?
Q2:
beta0=lin$coefficients[1]
beta1=lin$coefficients[2]
beta2=lin$coefficients[3]
2004 May 28
0
Negative binomial glm and dispersion
Using R 1.8.1, and the negative binomial glm implemented in MASS,
the default when using anova and a chi-square test is to divide the
deviance by the estimated dispersion. Using my UNIX version of S-plus (v
3.4), and the same MASS functions, the deviances are *not* divided by the
estimated dispersion.
Firstly, I'm wondering if anyone can enlighten about the correct procedure
(I thought
2004 Nov 15
0
how to obtain predicted labels for test data using "kerne lpls"
You need to do some extra work if you want to do classification with a
regression method. One simple way to do classification with PLS is to code
the classes as 0s and 1s (assuming there are only two classes) or -1s and
1s, fit the model, then threshold the prediction; e.g., those with predicted
values < 0.5 (in the 0/1 coding) get labeled as 0s. There's a predict()
method for mvr
2006 Jul 11
1
test regression against given slope for reduced major axis regression (RMA)
Hi,
for testing if the slope of experimental data differs from a
given slope I'm using the function
"test_regression_against_slope" (see below).
I am now confronted with the problem that I have data which
requires a modelII regression (also called reduced major axes
regression (RMA) or geometric mean regression). For this I use
the function "modelII" (see below).
What
2005 Mar 08
1
coefficient of partial determination...partial r square [ redux]
If I'm not mistaken, partial R-squared is the R^2 of the quantities plotted
in a partial residual plot, so you can base the computation on that. Prof.
Fox's `car' package on CRAN has a function for creating those plots, but you
need to figure out the way to extract the quantities being plotted.
[In any case, the basic tools for doing such computations are all in R, and
it
2010 Mar 25
1
Manually calculate SVM
Hi,
I'm learning more about SVMs and kernels in general. I've gotten used
to using the svm function in the e1071 package. It works great.
Now, I want to do/learn some more interesting stuff. (Perhaps my own
kernel and/or scoring system). So I want to better understand
1) how calculation of the kernel happens.
2) how to calculate the predicted value (y_hat) given a list of support
2005 Dec 05
1
Help
Hi R-Users,
I apologize if it is too simple question for all. I have a multivariate
dataset having 7 variables as independent and 1 dependent variable. 248
data points are there. I want to do out sample forecast first
considering 156 points. So I'll have to start from 157th point and
calculate the 157th y_hat value. In this way it will go to 248th data
point. Can any one tell me how I can