Displaying 20 results from an estimated 100 matches similar to: "Problem with predict() and factors"
2009 Jul 15
2
storing lm() results and other objects in a list
to clean up some code I would like to make a list of arbitrary length
to store?various objects for use in a loop
sample code:
############ BEGIN SAMPLE ##############
# You can see the need for a loop already
linearModel1=lm(modelSource ~ .,mcReg)
linearModel2=step(linearModel1)
linearModel3=lm(modelSource ~ .-1,mcReg)
linearModel4=step(linearModel3)
#custom
linearModel5=lm(modelSource ~ .
2009 Jul 21
2
Odd coefficent behavior
Why are my coefficients getting appended with a 1? It borks a match I
do later against the original list that doesn't have the random 1
added to the end.
> linearModel[[1]]
Call:
lm(formula = modelSource ~ +UNITBUILD + UNITDB + ITBUILD + ITDB +
UATBUILD + UATDB + HOGANCODE + RCF + ReleaseST1 + ReleaseST2 +
ReleaseBLA + Small.Bank.Acquisitions + HLY.NewYear + HLY.MLK +
HLY.PRES +
2010 Jan 07
1
Drop a part of an array\list\vector?
I did have a verbose description of why but rather then make everyone's eyes
bleed with useless details I ask the following :)
To make a long story short: How can I make newmcReg[[i]]["PreIO308"] go
away in the following list... er vector... no wait array.... dataframe....
awww crap...
summary(newmcReg[[i]])
UNITBUILD UNITDB ITBUILD ITDB
Mode :logical
2010 Jan 26
0
Trouble Highlighting outliers on Time Series Plot
I am having trouble plotting outliers on time series.
Give then following code:
############################################################
# find STL Outliers by weight and append sh2, use Robust
# this should allow the initial outliers to be filtered
# this section may be commented out.
############################################################
tsSourceDiag <-
2008 Sep 03
0
Graphics: Improving a Lattice plot - can it be done ?
Hallo all
I realise this might be a "too much to ask" question, but can I improve the Lattice plot produced by the following code? The type of figure I would like to produce in each segment of the plot appears below the code.
library(reserving) # http://toolkit.pbwiki.com/RToolkit <http://toolkit.pbwiki.com/RToolkit>
data(GenIns)
GenInsInc <- incrementalTriangle(GenIns)
2009 Jul 14
2
Proper Paste for Data Member
I imported a spreadsheet into a variable sh
e.g. sh$aaaa, sh$bbbb, etc...
doing the following:
tsSource <- ts(paste("sh$",NAMEVARIABLE,sep="") ... )
fails. The paste isn't evaluating properly. What is the proper way to
concatenate a data source with a member name such that they evaluate
properly.
actual code below:
doEnv <-
2009 Dec 08
0
Holiday Gift Perl Script for US Holiday Dummy Regressors
##### BEGIN CODE ######
#!/usr/bin/perl
######
#
# --start, -s = The date you would like to start generating regressors
#--end, -e = When to stop generating holiday regressros
# --scope, -c = D, W for Daily or Weekly respectively (e.g. Does this week
have a particular holiday)
# --file, -f = Ummm where to write the output silly!
#
# **NOTE** The EOM holiday is "End of Month" for
2009 Dec 08
0
Opps Correct Version of Holiday Regressor Perl Script
Here is the correct version. The old version is the redirect only version of
the script.
### BEGIN SCRIPT ####
#!/usr/bin/perl
######
# --start, -s = The date you would like to start generating regressors
#--end, -e = When to stop generating holiday regressros
# --scope, -c = D, W for Daily or Weekly respectively (e.g. Does this week
have a particular holiday)
# --file, -f = Ummm where to write
2007 Jan 16
2
problems with for loop
Hello,
With this program I try to repeat analysis for different years. The
results of the analysis are not printed when in the loop, except for the
year sequence. What is wrong?
Thanks a lot.
for (i in 92:99){
cat("\n",
"=============================================================\n",
"YEAR =",i,"\n",
2008 Nov 20
1
Repost:lattice graphics -- legend color problems
Hello R-folks,
I don't get the color of the legend in a lattice-plot right.
I select a palette from RColorBrewer and use (with a col = mypalette argument) it in the barchart plot.
The resulting graph shows the new palette in the graph, but uses the standard palette in the legend rectangles.
Adding a col argument into auto.key uses the new palette
with the legend text, but not in the
2009 Jul 15
2
Spaces in a name
I am reading regressors from an excel file (I have no control over the file)
and some of the element names have spaces:
i.e. "Small Bank Aquired"
but I have found that lm(SourceData ~ . - "Small Bank Aquired", mcReg)
doesn't work (mcReg = modelCurrentRegressors)
As they are toggles I have ran them through factor() to be treated propertly
as 0 or 1 but due to the fact I
2012 Jan 03
1
returning information from functions via attributes rather than return list
I would like to ask for advice from R experts about the benefits or
dangers of using attr to return information with an object that is
returned from a function. I have a feeling as though I have cheated by
using attributes, and wonder if I've done something fishy.
Maybe I mean to ask, where is the dividing line between attributes and
instance variables? The separation is not clear in my mind
2008 Nov 18
1
legend color problems
Hello R-folks,
I don't get the color of the legend in a lattice-plot right. I select a palette from RColorBrewer and use it in the barchart plot.
The resulting graph shows the new palette in the graph, but in the legend rectangles the standard palette is used. Adding a col argument into auto.key uses the new palette
with the legend text, but not in the rectangle fill.
What am I missing?
2010 Jan 11
1
Getting a date out of an indice in a time series
I have a weekly data set imported via:
tsSource=ts(sh1$I000,start=c(2004,1),freq=52)
I am now getting to some 'spit and polish' but I realize something I can't
wrap my head around.
Given an outlier I find at say tsSource[54] ... how can get translate index
54 into the date\week. I mean I can figure out obviously that entry 52 is
last week of 2004 but since the data goes for many
2013 Jun 06
1
Error invalid graphics state using text()
I'm using ssplot for drawing a map of Austria and colour the nine provinces
regarding their share of employment. Now I wanted to add the figures in each
province and failed miserably. Using the locator() and text() function
caused the error message "invalid graphics state". I try to show you what I
have done below, maybe you can find a general fault in my codes. I know that
it's
2009 May 11
1
predict function the other way around
Dear List,
Consider the following example
x=c(1,2,3,4,5)
y=c(2,4,6,8,10)
linearmodel=lm(y~x)
To predict a y-value if you know the corresponding x value is very easy
with the command predict.
predict(linearmodel, newdata=(x=1.5))
The other way around, to predict an x-value with a corresponding
y-value, doesn't work unfortunately.
Is there another function that can do that, or do I need to
2003 Aug 07
0
new version of Rcmdr package
Dear list members,
I've uploaded a new version of the Rcmdr package to CRAN. There are many
additions and (I hope) improvements, as indicated in the relevant portion
of the CHANGES file, reproduced below. As usual, comments, suggestions, and
bug reports are appreciated.
John
-------------------------------------------
Version 0.8-4
o Minor bug fixes and additional input-error
2010 Jan 26
0
create custom function to annotate a levelplot
Dear list users,
I modeled the probability of occurrence of one species: "Cyperus
dilatatus".
I modeled the species using three different approaches:
c("random","target","index")
What I want to achieve is to make a plot of all prediction maps in a row
with to conditional variables, that is, with the species and the
approach
I prepared a data.frame to try
2009 Nov 09
1
Getting Sphericity Tests for Within Subject Repeated Measure Anova (using "car" package)
Hello everyone,
I am trying to do within subjects repeated measures anova followed by the
test of sphericity (sample dataset below).
I am able to get either mixed model or linear model anova and TukeyHSD, but
have no luck with Repeated-Measures Assuming Sphericity or Separate
Sphericity Tests.
I am trying to follow example from "car" package, but it seems that I am not
getting something
2010 Jan 12
0
[Solved][Code Snippets] Dropping Empty Regressors
To make a long story short I was doing some in-sample testing in which some
dynamically created regressors would end up either all true or all false
based on the validation portion. In my case a new mainframe configuration
(this is a crappy way to handle a level shift but I do what I can.) So here
is the code snippet that finally let me pre-check my regressors and drop any
of them that were all